From 95e08e84c3a4a831beaaccb4aa26b21c01de5b63 Mon Sep 17 00:00:00 2001 From: Pontus Fransson Date: Thu, 13 Feb 2014 13:51:27 +0100 Subject: [PATCH 1/2] Network - Overloaded Connect in NetworkClient to use std::wstring. --- Code/Network/NetworkAPI/NetworkClient.cpp | 14 ++++++++++++++ Code/Network/NetworkAPI/NetworkClient.h | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/Code/Network/NetworkAPI/NetworkClient.cpp b/Code/Network/NetworkAPI/NetworkClient.cpp index 01ba495e..1f470c11 100644 --- a/Code/Network/NetworkAPI/NetworkClient.cpp +++ b/Code/Network/NetworkAPI/NetworkClient.cpp @@ -21,6 +21,9 @@ #include #include +//For conversion from wstring to string +#include + using namespace Oyster::Network; using namespace Oyster::Thread; using namespace Utility::DynamicMemory; @@ -293,6 +296,17 @@ bool NetworkClient::Connect(unsigned short port, const char serverIP[]) return true; } +bool NetworkClient::Connect(unsigned short port, std::wstring serverIP) +{ + //Convert from wstring to string. + typedef std::codecvt_utf8 convert_typeX; + std::wstring_convert converterX; + + std::string ip = converterX.to_bytes(serverIP); + + return this->Connect(port, ip.c_str()); +} + void NetworkClient::Disconnect() { if(!privateData) return; diff --git a/Code/Network/NetworkAPI/NetworkClient.h b/Code/Network/NetworkAPI/NetworkClient.h index a19f74e4..b7e0d6a4 100644 --- a/Code/Network/NetworkAPI/NetworkClient.h +++ b/Code/Network/NetworkAPI/NetworkClient.h @@ -88,6 +88,11 @@ namespace Oyster */ bool Connect(unsigned short port, const char serverIP[]); + /** + * + */ + bool Connect(unsigned short port, std::wstring serverIP); + /** * */ From d01acbcbe0352ce5f552a929026a085589c62b64 Mon Sep 17 00:00:00 2001 From: Pontus Fransson Date: Thu, 13 Feb 2014 15:21:05 +0100 Subject: [PATCH 2/2] Misc - Added text and textcolor to buttons, seperate render function. --- .../GameClientState/Buttons/ButtonEllipse.h | 20 ++--- .../GameClientState/Buttons/ButtonRectangle.h | 24 +++--- .../GameClientState/Buttons/EventButtonGUI.h | 76 +++++++++++++------ .../GameClientState/LoginState.cpp | 43 +++++++---- .../EventHandler/EventButtonCollection.cpp | 15 +++- .../Misc/EventHandler/EventButtonCollection.h | 3 +- Code/Misc/EventHandler/EventHandler.cpp | 12 ++- Code/Misc/EventHandler/EventHandler.h | 3 +- Code/Misc/EventHandler/IEventButton.h | 3 +- 9 files changed, 132 insertions(+), 67 deletions(-) diff --git a/Code/Game/DanBiasGame/GameClientState/Buttons/ButtonEllipse.h b/Code/Game/DanBiasGame/GameClientState/Buttons/ButtonEllipse.h index 5570fb2f..a922f141 100644 --- a/Code/Game/DanBiasGame/GameClientState/Buttons/ButtonEllipse.h +++ b/Code/Game/DanBiasGame/GameClientState/Buttons/ButtonEllipse.h @@ -21,17 +21,17 @@ namespace DanBias ButtonEllipse() : EventButtonGUI(), radius(0) {} - ButtonEllipse(std::wstring textureName, Owner owner, float xPos, float yPos, float textureWidth, float textureHeight, bool resizeToScreenAspectRatio = true) - : EventButtonGUI(textureName, owner, xPos, yPos, textureWidth, textureHeight, resizeToScreenAspectRatio) + ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize) {} - ButtonEllipse(std::wstring textureName, EventFunc func, float xPos, float yPos, float textureWidth, float textureHeight, bool resizeToScreenAspectRatio = true) - : EventButtonGUI(textureName, func, xPos, yPos, textureWidth, textureHeight, resizeToScreenAspectRatio) + ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize) {} - ButtonEllipse(std::wstring textureName, EventFunc func, Owner owner, float xPos, float yPos, float textureWidth, float textureHeight, bool resizeToScreenAspectRatio = true) - : EventButtonGUI(textureName, func, owner, xPos, yPos, textureWidth, textureHeight, resizeToScreenAspectRatio) + ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize) {} - ButtonEllipse(std::wstring textureName, EventFunc func, Owner owner, void* userData, float xPos, float yPos, float textureWidth, float textureHeight, bool resizeToScreenAspectRatio = true) - : EventButtonGUI(textureName, func, owner, userData, xPos, yPos, textureWidth, textureHeight, resizeToScreenAspectRatio) + ButtonEllipse(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize) {} virtual ~ButtonEllipse() {} @@ -42,8 +42,8 @@ namespace DanBias //Should come from the InputClass float xMouse = input.x, yMouse = input.y; - double normx = (xMouse - xPos) / width; - double normy = (yMouse - yPos) / height; + double normx = (xMouse - pos.x) / size.x; + double normy = (yMouse - pos.y) / size.y; return (normx * normx + normy * normy) < 0.25; } diff --git a/Code/Game/DanBiasGame/GameClientState/Buttons/ButtonRectangle.h b/Code/Game/DanBiasGame/GameClientState/Buttons/ButtonRectangle.h index 711afdf8..a0b3e94b 100644 --- a/Code/Game/DanBiasGame/GameClientState/Buttons/ButtonRectangle.h +++ b/Code/Game/DanBiasGame/GameClientState/Buttons/ButtonRectangle.h @@ -21,17 +21,17 @@ namespace DanBias ButtonRectangle() : EventButtonGUI(), width(0), height(0) {} - ButtonRectangle(std::wstring textureName, Owner owner, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true) - : EventButtonGUI(textureName, owner, xPos, yPos, width, height, resizeToScreenAspectRatio) + ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButtonGUI(textureName, buttonText, textColor, owner, pos, size, resize) {} - ButtonRectangle(std::wstring textureName, EventFunc func, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true) - : EventButtonGUI(textureName, func, xPos, yPos, width, height, resizeToScreenAspectRatio) + ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButtonGUI(textureName, buttonText, textColor, func, pos, size, resize) {} - ButtonRectangle(std::wstring textureName, EventFunc func, Owner owner, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true) - : EventButtonGUI(textureName, func, owner, xPos, yPos, width, height, resizeToScreenAspectRatio) + ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButtonGUI(textureName, buttonText, textColor, func, owner, pos, size, resize) {} - ButtonRectangle(std::wstring textureName, EventFunc func, Owner owner, void* userData, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true) - : EventButtonGUI(textureName, func, owner, userData, xPos, yPos, width, height, resizeToScreenAspectRatio) + ButtonRectangle(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButtonGUI(textureName, buttonText, textColor, func, owner, userData, pos, size, resize) {} virtual ~ButtonRectangle() {} @@ -42,10 +42,10 @@ namespace DanBias //Should come from the InputClass float xMouse = input.x, yMouse = input.y; - float widthTemp = xPos - width * 0.5f; - float widthTemp2 = xPos + width * 0.5f; - float heightTemp = yPos - height * 0.5f; - float heightTemp2 = yPos + height * 0.5f; + float widthTemp = pos.x - size.x * 0.5f; + float widthTemp2 = pos.x + size.x * 0.5f; + float heightTemp = pos.y - size.y * 0.5f; + float heightTemp2 = pos.y + size.y * 0.5f; //std::cout << p.x << ' ' << p.y << ' ' << widthTemp << ' ' << heightTemp << std::endl; if(xMouse >= widthTemp && xMouse <= widthTemp2 && diff --git a/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h b/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h index e71dd0fa..d4884fd7 100644 --- a/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h +++ b/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h @@ -8,40 +8,56 @@ #include "../Misc/EventHandler/EventButton.h" #include "../OysterGraphics/DllInterfaces/GFXAPI.h" + + namespace DanBias { namespace Client { + /*Dictates if the texture should be resized based on the screen aspect ratio. + + */ + enum ResizeAspectRatio + { + ResizeAspectRatio_None, + ResizeAspectRatio_Width, + ResizeAspectRatio_Height, + + ResizeAspectRatio_Count, + ResizeAspectRatio_Unknown = -1 + }; + + template class EventButtonGUI : public Oyster::Event::EventButton { public: EventButtonGUI() - : EventButton(), xPos(0), yPos(0), width(0), height(0), texture(NULL) + : EventButton(), pos(0, 0), size(0, 0), texture(NULL), buttonText(""), textColor(0, 0, 0) {} - EventButtonGUI(std::wstring textureName, Owner owner, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true) - : EventButton(owner), xPos(xPos), yPos(yPos), width(width), height(height), texture(NULL) + EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButton(owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) { CreateTexture(textureName); - if(resizeToScreenAspectRatio) ResizeWithAspectRatio(); + if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); } - EventButtonGUI(std::wstring textureName, EventFunc func, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true) - : EventButton(func), xPos(xPos), yPos(yPos), width(width), height(height), texture(NULL) + EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButton(func), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) { CreateTexture(textureName); - if(resizeToScreenAspectRatio) ResizeWithAspectRatio(); + if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); } - EventButtonGUI(std::wstring textureName, EventFunc func, Owner owner, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true) - : EventButton(func, owner), xPos(xPos), yPos(yPos), width(width), height(height), texture(NULL) + EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButton(func, owner), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) { CreateTexture(textureName); - if(resizeToScreenAspectRatio) ResizeWithAspectRatio(); + if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); } - EventButtonGUI(std::wstring textureName, EventFunc func, Owner owner, void* userData, float xPos, float yPos, float width, float height, bool resizeToScreenAspectRatio = true) - : EventButton(func, owner, userData), xPos(xPos), yPos(yPos), width(width), height(height), texture(NULL) + EventButtonGUI(std::wstring textureName, std::wstring buttonText, Oyster::Math::Float3 textColor, EventFunc func, Owner owner, void* userData, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize = ResizeAspectRatio_Height) + : EventButton(func, owner, userData), pos(pos), size(size), texture(NULL), buttonText(buttonText), textColor(textColor) { CreateTexture(textureName); - if(resizeToScreenAspectRatio) ResizeWithAspectRatio(); + if(resize != ResizeAspectRatio_None) ResizeWithAspectRatio(resize); } virtual ~EventButtonGUI() { @@ -55,7 +71,7 @@ namespace DanBias texture = Oyster::Graphics::API::CreateTexture(textureName); } - virtual void Render() + virtual void RenderTexture() { if(EventButton::Enabled()) { @@ -64,32 +80,48 @@ namespace DanBias if(EventButton::GetState() == ButtonState_None) { - Oyster::Graphics::API::RenderGuiElement(texture, Oyster::Math::Float2(xPos, yPos), Oyster::Math::Float2(width, height), Oyster::Math::Float3(1.0f, 1.0f, 1.0f)); + Oyster::Graphics::API::RenderGuiElement(texture, pos.xy, size, Oyster::Math::Float3(1.0f, 1.0f, 1.0f)); } else if(EventButton::GetState() == ButtonState_Hover) { - Oyster::Graphics::API::RenderGuiElement(texture, Oyster::Math::Float2(xPos, yPos), Oyster::Math::Float2(width, height), Oyster::Math::Float3(0.0f, 1.0f, 0.0f)); + Oyster::Graphics::API::RenderGuiElement(texture, pos.xy, size, Oyster::Math::Float3(0.0f, 1.0f, 0.0f)); } else { - Oyster::Graphics::API::RenderGuiElement(texture, Oyster::Math::Float2(xPos, yPos), Oyster::Math::Float2(width, height), Oyster::Math::Float3(1.0f, 0.0f, 0.0f)); + Oyster::Graphics::API::RenderGuiElement(texture, pos.xy, size, Oyster::Math::Float3(1.0f, 0.0f, 0.0f)); } } } - void ResizeWithAspectRatio() + virtual void RenderText() + { + if(buttonText.size() > 0) + { + Oyster::Graphics::API::RenderText(buttonText, pos.xy, size, textColor); + } + } + + private: + void ResizeWithAspectRatio(ResizeAspectRatio resize) { RECT r; GetClientRect(WindowShell::GetHWND(), &r); - height *= (float)r.right/(float)r.bottom; + + if(resize == ResizeAspectRatio_Height) + size.y *= (float)r.right/(float)r.bottom; + else if(resize == ResizeAspectRatio_Width) + size.x *= (float)r.bottom/(float)r.right; } protected: - float xPos, yPos; - float width, height; - Oyster::Graphics::API::Texture texture; + Oyster::Math::Float3 pos; + Oyster::Math::Float2 size; + Oyster::Graphics::API::Texture texture; + + std::wstring buttonText; + Oyster::Math::Float3 textColor; }; } } diff --git a/Code/Game/DanBiasGame/GameClientState/LoginState.cpp b/Code/Game/DanBiasGame/GameClientState/LoginState.cpp index 297335c8..37a3e951 100644 --- a/Code/Game/DanBiasGame/GameClientState/LoginState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LoginState.cpp @@ -109,23 +109,33 @@ bool LoginState::Init(Oyster::Network::NetworkClient* nwClient) InitCamera(Oyster::Math::Float3(0,0,5.4f)); //Create menu buttons - //privData->collection = new EventButtonCollection; EventHandler::Instance().AddCollection(&privData->collection); - privData->collection.AddButton(new ButtonEllipse(L"circle.png", &LoginState::ButtonCallback, this, (void*)Options, 0.2f, 0.2f, 0.1f, 0.1f)); - privData->collection.AddButton(new ButtonEllipse(L"circle.png", &LoginState::ButtonCallback, this, (void*)Options, 0.2f, 0.3f, 0.1f, 0.1f)); - privData->collection.AddButton(new ButtonEllipse(L"circle.png", &LoginState::ButtonCallback, this, (void*)Options, 0.2f, 0.4f, 0.1f, 0.1f)); - privData->collection.AddButton(new ButtonEllipse(L"circle.png", &LoginState::ButtonCallback, this, (void*)Options, 0.2f, 0.5f, 0.1f, 0.1f)); - - privData->collection.AddButton(new ButtonRectangle(L"button.png", &LoginState::ButtonCallback, this, (void*)Options, 0.15f, 0.05f, 0.1f, 0.1f)); - privData->collection.AddButton(new ButtonRectangle(L"button.png", &LoginState::ButtonCallback, this, (void*)Options, 0.25f, 0.05f, 0.1f, 0.1f)); - privData->collection.AddButton(new ButtonRectangle(L"button.png", &LoginState::ButtonCallback, this, (void*)Options, 0.35f, 0.05f, 0.1f, 0.1f)); - privData->collection.AddButton(new ButtonRectangle(L"button.png", &LoginState::ButtonCallback, this, (void*)Options, 0.45f, 0.05f, 0.1f, 0.1f)); - - privData->collection.AddButton(new ButtonRectangle(L"button.png", &LoginState::ButtonCallback, this, (void*)Create, 0.5f, 0.5f, 0.3f, 0.3f)); - + privData->collection.AddButton(new ButtonEllipse(L"circle.png", L"Hej", Oyster::Math::Float3(1, 1, 0), &LoginState::ButtonCallback, this, + (void*)Options, Oyster::Math::Float3(0.2f, 0.2f, 0.0f), Oyster::Math::Float2(0.1f, 0.1f), ResizeAspectRatio_Width)); + privData->collection.AddButton(new ButtonEllipse(L"circle.png", L"Hej", Oyster::Math::Float3(1, 0, 0), &LoginState::ButtonCallback, this, + (void*)Options, Oyster::Math::Float3(0.2f, 0.3f, 0.0f), Oyster::Math::Float2(0.1f, 0.1f), ResizeAspectRatio_Width)); + privData->collection.AddButton(new ButtonEllipse(L"circle.png", L"Hej", Oyster::Math::Float3(1, 0, 0), &LoginState::ButtonCallback, this, + (void*)Options, Oyster::Math::Float3(0.2f, 0.4f, 0.0f), Oyster::Math::Float2(0.1f, 0.1f), ResizeAspectRatio_Width)); + privData->collection.AddButton(new ButtonEllipse(L"circle.png", L"Hej", Oyster::Math::Float3(1, 0, 0), &LoginState::ButtonCallback, this, + (void*)Options, Oyster::Math::Float3(0.2f, 0.5f, 0.0f), Oyster::Math::Float2(0.1f, 0.1f), ResizeAspectRatio_Width)); + + privData->collection.AddButton(new ButtonRectangle(L"button.png", L"", Oyster::Math::Float3(1, 0, 0), &LoginState::ButtonCallback, this, + (void*)Options, Oyster::Math::Float3(0.15f, 0.05f, 0.0f), Oyster::Math::Float2(0.1f, 0.1f))); + privData->collection.AddButton(new ButtonRectangle(L"button.png", L"Hej", Oyster::Math::Float3(1, 0, 0), &LoginState::ButtonCallback, this, + (void*)Options, Oyster::Math::Float3(0.25f, 0.05f, 0.0f), Oyster::Math::Float2(0.1f, 0.1f))); + privData->collection.AddButton(new ButtonRectangle(L"button.png", L"Hej", Oyster::Math::Float3(1, 0, 0), &LoginState::ButtonCallback, this, + (void*)Options, Oyster::Math::Float3(0.35f, 0.05f, 0.0f), Oyster::Math::Float2(0.1f, 0.1f))); + privData->collection.AddButton(new ButtonRectangle(L"button.png", L"Hej", Oyster::Math::Float3(1, 0, 0), &LoginState::ButtonCallback, this, + (void*)Options, Oyster::Math::Float3(0.45f, 0.05f, 0.0f), Oyster::Math::Float2(0.1f, 0.1f))); + + privData->collection.AddButton(new ButtonRectangle(L"button.png", L"Create Game", Oyster::Math::Float3(1, 0, 0), &LoginState::ButtonCallback, this, + (void*)Create, Oyster::Math::Float3(0.5f, 0.5f, 0.0f), Oyster::Math::Float2(0.3f, 0.3f))); + //Incr/decr buttons . - privData->collection.AddButton(new ButtonRectangle(L"button.png", &LoginState::ButtonCallback, this, (void*)Incr, 0.85f, 0.2f, 0.1f, 0.1f)); - privData->collection.AddButton(new ButtonRectangle(L"button.png", &LoginState::ButtonCallback, this, (void*)Decr, 0.55f, 0.2f, 0.1f, 0.1f)); + privData->collection.AddButton(new ButtonRectangle(L"button.png", L"Hej", Oyster::Math::Float3(1, 0, 0), &LoginState::ButtonCallback, this, + (void*)Incr, Oyster::Math::Float3(0.85f, 0.2f, 0.0f), Oyster::Math::Float2(0.1f, 0.1f))); + privData->collection.AddButton(new ButtonRectangle(L"button.png", L"Hej", Oyster::Math::Float3(1, 0, 0), &LoginState::ButtonCallback, this, + (void*)Decr, Oyster::Math::Float3(0.55f, 0.2f, 0.0f), Oyster::Math::Float2(0.1f, 0.1f))); privData->createGame = false; privData->testNumber = 0; @@ -236,7 +246,7 @@ bool LoginState::Render(float dt) //Render buttons Oyster::Graphics::API::StartGuiRender(); - EventHandler::Instance().Render(); + EventHandler::Instance().RenderTexture(); std::wstring number; wchar_t temp[10]; @@ -244,6 +254,7 @@ bool LoginState::Render(float dt) number = temp; Oyster::Graphics::API::StartTextRender(); + EventHandler::Instance().RenderText(); Oyster::Graphics::API::RenderText(number, Oyster::Math::Float2(0.7f, 0.2f), Oyster::Math::Float2(0.1f, 0.1f*(1008.0f/730.0f)), Oyster::Math::Float3(1.0f, 0.0f, 0.0f)); Oyster::Graphics::API::EndFrame(); diff --git a/Code/Misc/EventHandler/EventButtonCollection.cpp b/Code/Misc/EventHandler/EventButtonCollection.cpp index 9e52805e..72d0ba24 100644 --- a/Code/Misc/EventHandler/EventButtonCollection.cpp +++ b/Code/Misc/EventHandler/EventButtonCollection.cpp @@ -43,13 +43,24 @@ void EventButtonCollection::Update(MouseInput& input) } } -void EventButtonCollection::Render() +void EventButtonCollection::RenderTexture() { if(this->collectionState == EventCollectionState_Enabled) { for(int i = 0; i < (int)buttons.size(); i++) { - buttons[i]->Render(); + buttons[i]->RenderTexture(); + } + } +} + +void EventButtonCollection::RenderText() +{ + if(this->collectionState == EventCollectionState_Enabled) + { + for(int i = 0; i < (int)buttons.size(); i++) + { + buttons[i]->RenderText(); } } } diff --git a/Code/Misc/EventHandler/EventButtonCollection.h b/Code/Misc/EventHandler/EventButtonCollection.h index 3cb3c891..8c39d171 100644 --- a/Code/Misc/EventHandler/EventButtonCollection.h +++ b/Code/Misc/EventHandler/EventButtonCollection.h @@ -37,7 +37,8 @@ namespace Oyster ~EventButtonCollection(); void Update(MouseInput& input); - void Render(); + void RenderTexture(); + void RenderText(); /*Add a button to the collection when a button is added to the collection you are not allowed to delete it. */ diff --git a/Code/Misc/EventHandler/EventHandler.cpp b/Code/Misc/EventHandler/EventHandler.cpp index 558b776c..24dca38a 100644 --- a/Code/Misc/EventHandler/EventHandler.cpp +++ b/Code/Misc/EventHandler/EventHandler.cpp @@ -35,11 +35,19 @@ void EventHandler::Update(MouseInput& input) } } -void EventHandler::Render() +void EventHandler::RenderTexture() { for(int i = 0; i < (int)collections.size(); i++) { - collections.at(i)->Render(); + collections.at(i)->RenderTexture(); + } +} + +void EventHandler::RenderText() +{ + for(int i = 0; i < (int)collections.size(); i++) + { + collections.at(i)->RenderText(); } } diff --git a/Code/Misc/EventHandler/EventHandler.h b/Code/Misc/EventHandler/EventHandler.h index 79196afb..82c25e1a 100644 --- a/Code/Misc/EventHandler/EventHandler.h +++ b/Code/Misc/EventHandler/EventHandler.h @@ -27,7 +27,8 @@ namespace Oyster void Clean(); void Update(MouseInput& input); - void Render(); + void RenderTexture(); + void RenderText(); /*Add a collection to the EventHandler will only add collections not already present in the list. diff --git a/Code/Misc/EventHandler/IEventButton.h b/Code/Misc/EventHandler/IEventButton.h index 62044eb2..d0c754f9 100644 --- a/Code/Misc/EventHandler/IEventButton.h +++ b/Code/Misc/EventHandler/IEventButton.h @@ -33,7 +33,8 @@ namespace Oyster public: virtual ~IEventButton(){} - virtual void Render() = 0; + virtual void RenderTexture() = 0; + virtual void RenderText() = 0; virtual void Update(MouseInput& input) = 0;