diff --git a/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h b/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h index 72ac354a..554365ea 100644 --- a/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h +++ b/Code/Game/DanBiasGame/GameClientState/Buttons/EventButtonGUI.h @@ -78,21 +78,24 @@ namespace DanBias { if(EventButton::Enabled()) { + // let the using dev decide what is rendered + Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(1.0f, 1.0f, 1.0f)); + //Render att xPos and yPos //With width and height - if(EventButton::GetState() == ButtonState_None) - { - //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, pos.xy, size, Oyster::Math::Float3(0.0f, 1.0f, 0.0f)); - } - else - { - //Oyster::Graphics::API::RenderGuiElement(texture, pos.xy, size, Oyster::Math::Float3(1.0f, 0.0f, 0.0f)); - } + //if(EventButton::GetState() == ButtonState_None) + //{ + // Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(1.0f, 1.0f, 1.0f)); + //} + //else if(EventButton::GetState() == ButtonState_Hover) + //{ + // Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(0.0f, 1.0f, 0.0f)); + //} + //else + //{ + // Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(1.0f, 0.0f, 0.0f)); + //} } } @@ -101,7 +104,7 @@ namespace DanBias { if(buttonText.size() > 0) { - //Oyster::Graphics::API::RenderText(buttonText, pos.xy, size, textColor); + Oyster::Graphics::API::RenderText(buttonText, pos, size, size.y, textColor); } } diff --git a/Code/Game/DanBiasGame/GameClientState/Buttons/TextField.h b/Code/Game/DanBiasGame/GameClientState/Buttons/TextField.h index 62866834..3cfc7380 100644 --- a/Code/Game/DanBiasGame/GameClientState/Buttons/TextField.h +++ b/Code/Game/DanBiasGame/GameClientState/Buttons/TextField.h @@ -28,7 +28,7 @@ namespace DanBias { namespace Client const ::std::wstring & operator[]( unsigned int i ) const; ::std::wstring & operator[]( unsigned int i ); - void SetTextHeight( ::Oyster::Math::Float h ); + void SetFontHeight( ::Oyster::Math::Float h ); void SetLineSpacing( ::Oyster::Math::Float ls ); void SetBottomAligned(); @@ -46,7 +46,7 @@ namespace DanBias { namespace Client private: bool isBottomAligned; - ::Oyster::Math::Float textHeight, lineSpacing; + ::Oyster::Math::Float fontHeight, lineSpacing; ::std::vector<::std::wstring> lines; }; @@ -56,7 +56,7 @@ namespace DanBias { namespace Client TextField::TextField() : ButtonRectangle() { - this->textHeight = 0.025f; + this->fontHeight = 0.025f; this->lineSpacing = 0.001f; this->isBottomAligned = true; } @@ -65,7 +65,7 @@ namespace DanBias { namespace Client TextField::TextField( ::std::wstring backgroundTexture, ::Oyster::Math::Float3 textColor, Owner owner, Oyster::Math::Float3 pos, Oyster::Math::Float2 size, ResizeAspectRatio resize ) : ButtonRectangle( backgroundTexture, L"", textColor, owner, pos, size, resize ) { - this->textHeight = 0.025f; + this->fontHeight = 0.025f; this->lineSpacing = 0.001f; this->isBottomAligned = true; } @@ -76,12 +76,12 @@ namespace DanBias { namespace Client template void TextField::RenderText() { - ::Oyster::Math::Float lineStep = this->textHeight + this->lineSpacing; - ::Oyster::Math::Float2 rowSize = ::Oyster::Math::Float2( this->size.x, this->textHeight ); + ::Oyster::Math::Float lineStep = this->fontHeight + this->lineSpacing; + ::Oyster::Math::Float2 rowSize = ::Oyster::Math::Float2( this->size.x, this->fontHeight ); if( this->isBottomAligned ) { - ::Oyster::Math::Float2 topLeft = this->pos; + ::Oyster::Math::Float3 topLeft = this->pos; topLeft.y += this->size.y - lineStep; auto line = this->lines.rbegin(); @@ -89,7 +89,7 @@ namespace DanBias { namespace Client { if( topLeft.y - lineStep >= this->pos.y ) { - ::Oyster::Graphics::API::RenderText( (*line), topLeft, rowSize, this->textColor ); + ::Oyster::Graphics::API::RenderText( (*line), topLeft, rowSize, this->fontHeight, this->textColor ); topLeft.y -= lineStep; } else break; @@ -97,14 +97,14 @@ namespace DanBias { namespace Client } else { - ::Oyster::Math::Float2 topLeft = this->pos; + ::Oyster::Math::Float3 topLeft = this->pos; auto line = this->lines.begin(); for( ; line != this->lines.end(); ++line ) { if( topLeft.y + lineStep < this->size.y ) { - ::Oyster::Graphics::API::RenderText( (*line), topLeft, rowSize, this->textColor ); + ::Oyster::Graphics::API::RenderText( (*line), topLeft, rowSize, this->fontHeight, this->textColor ); topLeft.y += lineStep; } else break; @@ -125,9 +125,9 @@ namespace DanBias { namespace Client } template - void TextField::SetTextHeight( ::Oyster::Math::Float h ) + void TextField::SetFontHeight( ::Oyster::Math::Float h ) { - this->textHeight = h; + this->fontHeight = h; } template diff --git a/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp b/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp index bf713d85..936d7c3c 100644 --- a/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LanMenuState.cpp @@ -63,7 +63,7 @@ bool LanMenuState::Init(Network::NetworkClient* nwClient) 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 ); this->privData->connectIP->ReserveLines( 1 ); this->privData->connectIP->AppendText( L"127.0.0.1" ); - this->privData->connectIP->SetTextHeight( 0.1f ); + this->privData->connectIP->SetFontHeight( 0.1f ); this->privData->connectIP->SetLineSpacing( 0.0f ); this->privData->guiElements.AddButton( this->privData->connectIP ); @@ -95,7 +95,7 @@ bool LanMenuState::Render( ) Graphics::API::StartGuiRender(); - Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) ); + Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) ); this->privData->guiElements.RenderTexture(); Graphics::API::StartTextRender(); diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyAdminState.cpp b/Code/Game/DanBiasGame/GameClientState/LobbyAdminState.cpp index ccf6bbf0..9416f01e 100644 --- a/Code/Game/DanBiasGame/GameClientState/LobbyAdminState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LobbyAdminState.cpp @@ -83,7 +83,7 @@ bool LobbyAdminState::Render( ) Graphics::API::NewFrame(); Graphics::API::StartGuiRender(); - Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) ); + Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) ); this->privData->guiElements.RenderTexture(); Graphics::API::StartTextRender(); diff --git a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp index 5dd2bc9b..8643c777 100644 --- a/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/LobbyState.cpp @@ -83,7 +83,7 @@ bool LobbyState::Render( ) Graphics::API::NewFrame(); Graphics::API::StartGuiRender(); - Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) ); + Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) ); this->privData->guiElements.RenderTexture(); Graphics::API::StartTextRender(); diff --git a/Code/Game/DanBiasGame/GameClientState/MainState.cpp b/Code/Game/DanBiasGame/GameClientState/MainState.cpp index b0b226e6..81794252 100644 --- a/Code/Game/DanBiasGame/GameClientState/MainState.cpp +++ b/Code/Game/DanBiasGame/GameClientState/MainState.cpp @@ -85,7 +85,7 @@ bool MainState::Render() Graphics::API::NewFrame(); Graphics::API::StartGuiRender(); - Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) ); + Graphics::API::RenderGuiElement( this->privData->background, Float3(0.5f, 0.5f, 1.0f), Float2(1.0f) ); this->privData->guiElements.RenderTexture(); Graphics::API::StartTextRender(); @@ -99,7 +99,7 @@ bool MainState::Release() { if( this->privData ) { - Graphics::API::DeleteTexture( this->privData->background ); // TODO: @todo bug caught when exiting by X + Graphics::API::DeleteTexture( this->privData->background ); EventHandler::Instance().ReleaseCollection( &this->privData->guiElements ); this->privData = NULL;