Merge errors dealt with

This commit is contained in:
Dander7BD 2014-02-14 12:09:59 +01:00
parent 66d4fcef3a
commit e6c5f1f6e5
6 changed files with 34 additions and 31 deletions

View File

@ -78,21 +78,24 @@ namespace DanBias
{
if(EventButton<Owner>::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<Owner>::GetState() == ButtonState_None)
{
//Oyster::Graphics::API::RenderGuiElement(texture, pos.xy, size, Oyster::Math::Float3(1.0f, 1.0f, 1.0f));
}
else if(EventButton<Owner>::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<Owner>::GetState() == ButtonState_None)
//{
// Oyster::Graphics::API::RenderGuiElement(texture, pos, size, Oyster::Math::Float3(1.0f, 1.0f, 1.0f));
//}
//else if(EventButton<Owner>::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);
}
}

View File

@ -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<Owner>::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<Owner>::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<typename Owner>
void TextField<Owner>::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<typename Owner>
void TextField<Owner>::SetTextHeight( ::Oyster::Math::Float h )
void TextField<Owner>::SetFontHeight( ::Oyster::Math::Float h )
{
this->textHeight = h;
this->fontHeight = h;
}
template<typename Owner>

View File

@ -63,7 +63,7 @@ bool LanMenuState::Init(Network::NetworkClient* nwClient)
this->privData->connectIP = new TextField<LanMenuState*>( 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();

View File

@ -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();

View File

@ -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();

View File

@ -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;