diff --git a/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp b/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp index bffd8c8a..c4d2b41d 100644 --- a/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp @@ -57,7 +57,7 @@ bool LanMenuState::Init(Network::NetworkClient* nwClient) // create guiElements ButtonRectangle *guiElements; //0.5f, 0.2f, 0.3f, 0.1f, - guiElements = new ButtonRectangle( L"earth_md.png", L"", Float3(1.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + guiElements = new ButtonRectangle( L"earth_md.png", L"Connect", Float3(1.0f), OnButtonInteract_Connect, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); this->privData->guiElements.AddButton( guiElements ); this->privData->connectIP = new TextField( L"earth_md.png", Float3(1.0f), this, Float3(0.1f, 0.2f, 0.5f), Float2(0.45f, 0.1f), ResizeAspectRatio_Width ); diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyAdminState.cpp b/Code/Game/DanBiasGame/GameClientState/LobbyAdminState.cpp index e6e764ea..21afb54b 100644 --- a/Code/Game/DanBiasGame/GameClientState/LobbyAdminState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LobbyAdminState.cpp @@ -23,10 +23,10 @@ struct LobbyAdminState::MyData GameClientState::ClientState nextState; NetworkClient *nwClient; Graphics::API::Texture background; - EventButtonCollection button; + EventButtonCollection guiElements; } privData; -void OnButtonInteract_Ready( Oyster::Event::ButtonEvent& e ); +void OnButtonInteract_Ready( Oyster::Event::ButtonEvent& e ); LobbyAdminState::LobbyAdminState(void) {} @@ -46,13 +46,13 @@ bool LobbyAdminState::Init(NetworkClient* nwClient) this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); // create buttons - ButtonRectangle *button; + ButtonRectangle *button; - button = new ButtonRectangle( L"earth_md.png", OnButtonInteract_Ready, this, 0.5f, 0.2f, 0.3f, 0.1f, true ); - this->privData->button.AddButton( button ); + button = new ButtonRectangle( L"earth_md.png", L"Ready", Float3(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + this->privData->guiElements.AddButton( button ); // bind button collection to the singleton eventhandler - EventHandler::Instance().AddCollection( &this->privData->button ); + EventHandler::Instance().AddCollection( &this->privData->guiElements ); return true; } @@ -85,7 +85,10 @@ bool LobbyAdminState::Render( ) Graphics::API::StartGuiRender(); Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) ); - this->privData->button.Render(); + this->privData->guiElements.RenderTexture(); + + Graphics::API::StartTextRender(); + this->privData->guiElements.RenderText(); Graphics::API::EndFrame(); return true; @@ -139,7 +142,7 @@ void LobbyAdminState::DataRecieved( NetEvent& e ) +void OnButtonInteract_Ready( Oyster::Event::ButtonEvent& e ) { switch( e.state ) { diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp index 77ec5a86..37f10f1d 100644 --- a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp @@ -23,10 +23,10 @@ struct LobbyState::MyData GameClientState::ClientState nextState; NetworkClient *nwClient; Graphics::API::Texture background; - EventButtonCollection button; + EventButtonCollection guiElements; } privData; -void OnButtonInteract_Ready( Oyster::Event::ButtonEvent& e ); +void OnButtonInteract_Ready( Oyster::Event::ButtonEvent& e ); LobbyState::LobbyState(void) {} @@ -46,13 +46,13 @@ bool LobbyState::Init(NetworkClient* nwClient) this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" ); // create buttons - ButtonRectangle *button; + ButtonRectangle *button; - button = new ButtonRectangle( L"earth_md.png", OnButtonInteract_Ready, this, 0.5f, 0.2f, 0.3f, 0.1f, true ); - this->privData->button.AddButton( button ); + button = new ButtonRectangle( L"earth_md.png", L"", Float3(1.0f), OnButtonInteract_Ready, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); + this->privData->guiElements.AddButton( button ); // bind button collection to the singleton eventhandler - EventHandler::Instance().AddCollection( &this->privData->button ); + EventHandler::Instance().AddCollection( &this->privData->guiElements ); return true; } @@ -85,7 +85,10 @@ bool LobbyState::Render( ) Graphics::API::StartGuiRender(); Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) ); - this->privData->button.Render(); + this->privData->guiElements.RenderTexture(); + + Graphics::API::StartTextRender(); + this->privData->guiElements.RenderText(); Graphics::API::EndFrame(); return true; @@ -139,7 +142,7 @@ void LobbyState::DataRecieved( NetEvent& e ) +void OnButtonInteract_Ready( Oyster::Event::ButtonEvent& e ) { switch( e.state ) { diff --git a/Code/Game/DanBiasGame/GameClientState/MainState.cpp b/Code/Game/DanBiasGame/GameClientState/MainState.cpp index 771fc1ee..dc6f88b3 100644 --- a/Code/Game/DanBiasGame/GameClientState/MainState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/MainState.cpp @@ -25,7 +25,7 @@ struct MainState::MyData GameClientState::ClientState nextState; NetworkClient *nwClient; Graphics::API::Texture background; - EventButtonCollection button; + EventButtonCollection guiElements; }; void OnButtonInteract_Create( Oyster::Event::ButtonEvent& e ); @@ -53,16 +53,16 @@ bool MainState::Init( NetworkClient* nwClient ) ButtonRectangle *button; button = new ButtonRectangle( L"earth_md.png", L"Create", Float3(1.0f), OnButtonInteract_Create, this, Float3(0.5f, 0.2f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); - this->privData->button.AddButton( button ); + this->privData->guiElements.AddButton( button ); button = new ButtonRectangle( L"skysphere_md.png", L"Join", Float3(1.0f), OnButtonInteract_Join, this, Float3(0.5f, 0.4f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); - this->privData->button.AddButton( button ); + this->privData->guiElements.AddButton( button ); button = new ButtonRectangle( L"plane_texture_md.png", L"Quit", Float3(1.0f), OnButtonInteract_Quit, this, Float3(0.5f, 0.8f, 0.5f), Float2(0.3f, 0.1f), ResizeAspectRatio_Width ); - this->privData->button.AddButton( button ); + this->privData->guiElements.AddButton( button ); // bind button collection to the singleton eventhandler - EventHandler::Instance().AddCollection( &this->privData->button ); + EventHandler::Instance().AddCollection( &this->privData->guiElements ); return true; } @@ -87,10 +87,10 @@ bool MainState::Render() Graphics::API::StartGuiRender(); Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) ); - this->privData->button.RenderTexture(); + this->privData->guiElements.RenderTexture(); Graphics::API::StartTextRender(); - this->privData->button.RenderText(); + this->privData->guiElements.RenderText(); Graphics::API::EndFrame(); return true; @@ -101,7 +101,7 @@ bool MainState::Release() if( this->privData ) { Graphics::API::DeleteTexture( this->privData->background ); // TODO: @todo bug caught when exiting by X - EventHandler::Instance().ReleaseCollection( &this->privData->button ); + EventHandler::Instance().ReleaseCollection( &this->privData->guiElements ); this->privData = NULL; // button collection will be autoreleased from EventHandler