parent
d4139e265e
commit
b9895f8c7f
|
@ -57,7 +57,7 @@ bool LanMenuState::Init(Network::NetworkClient* nwClient)
|
||||||
// create guiElements
|
// create guiElements
|
||||||
ButtonRectangle<LanMenuState*> *guiElements;
|
ButtonRectangle<LanMenuState*> *guiElements;
|
||||||
//0.5f, 0.2f, 0.3f, 0.1f,
|
//0.5f, 0.2f, 0.3f, 0.1f,
|
||||||
guiElements = new ButtonRectangle<LanMenuState*>( 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<LanMenuState*>( 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->guiElements.AddButton( guiElements );
|
||||||
|
|
||||||
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 = 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 );
|
||||||
|
|
|
@ -23,10 +23,10 @@ struct LobbyAdminState::MyData
|
||||||
GameClientState::ClientState nextState;
|
GameClientState::ClientState nextState;
|
||||||
NetworkClient *nwClient;
|
NetworkClient *nwClient;
|
||||||
Graphics::API::Texture background;
|
Graphics::API::Texture background;
|
||||||
EventButtonCollection button;
|
EventButtonCollection guiElements;
|
||||||
} privData;
|
} privData;
|
||||||
|
|
||||||
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<GameClientState*>& e );
|
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<LobbyAdminState*>& e );
|
||||||
|
|
||||||
LobbyAdminState::LobbyAdminState(void) {}
|
LobbyAdminState::LobbyAdminState(void) {}
|
||||||
|
|
||||||
|
@ -46,13 +46,13 @@ bool LobbyAdminState::Init(NetworkClient* nwClient)
|
||||||
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
|
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
|
||||||
|
|
||||||
// create buttons
|
// create buttons
|
||||||
ButtonRectangle<GameClientState*> *button;
|
ButtonRectangle<LobbyAdminState*> *button;
|
||||||
|
|
||||||
button = new ButtonRectangle<GameClientState*>( L"earth_md.png", OnButtonInteract_Ready, this, 0.5f, 0.2f, 0.3f, 0.1f, true );
|
button = new ButtonRectangle<LobbyAdminState*>( 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->button.AddButton( button );
|
this->privData->guiElements.AddButton( button );
|
||||||
|
|
||||||
// bind button collection to the singleton eventhandler
|
// bind button collection to the singleton eventhandler
|
||||||
EventHandler::Instance().AddCollection( &this->privData->button );
|
EventHandler::Instance().AddCollection( &this->privData->guiElements );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,10 @@ bool LobbyAdminState::Render( )
|
||||||
Graphics::API::StartGuiRender();
|
Graphics::API::StartGuiRender();
|
||||||
|
|
||||||
Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) );
|
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();
|
Graphics::API::EndFrame();
|
||||||
return true;
|
return true;
|
||||||
|
@ -139,7 +142,7 @@ void LobbyAdminState::DataRecieved( NetEvent<NetworkClient*, NetworkClient::Clie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<GameClientState*>& e )
|
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<LobbyAdminState*>& e )
|
||||||
{
|
{
|
||||||
switch( e.state )
|
switch( e.state )
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,10 +23,10 @@ struct LobbyState::MyData
|
||||||
GameClientState::ClientState nextState;
|
GameClientState::ClientState nextState;
|
||||||
NetworkClient *nwClient;
|
NetworkClient *nwClient;
|
||||||
Graphics::API::Texture background;
|
Graphics::API::Texture background;
|
||||||
EventButtonCollection button;
|
EventButtonCollection guiElements;
|
||||||
} privData;
|
} privData;
|
||||||
|
|
||||||
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<GameClientState*>& e );
|
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<LobbyState*>& e );
|
||||||
|
|
||||||
LobbyState::LobbyState(void) {}
|
LobbyState::LobbyState(void) {}
|
||||||
|
|
||||||
|
@ -46,13 +46,13 @@ bool LobbyState::Init(NetworkClient* nwClient)
|
||||||
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
|
this->privData->background = Graphics::API::CreateTexture( L"grass_md.png" );
|
||||||
|
|
||||||
// create buttons
|
// create buttons
|
||||||
ButtonRectangle<GameClientState*> *button;
|
ButtonRectangle<LobbyState*> *button;
|
||||||
|
|
||||||
button = new ButtonRectangle<GameClientState*>( L"earth_md.png", OnButtonInteract_Ready, this, 0.5f, 0.2f, 0.3f, 0.1f, true );
|
button = new ButtonRectangle<LobbyState*>( 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->button.AddButton( button );
|
this->privData->guiElements.AddButton( button );
|
||||||
|
|
||||||
// bind button collection to the singleton eventhandler
|
// bind button collection to the singleton eventhandler
|
||||||
EventHandler::Instance().AddCollection( &this->privData->button );
|
EventHandler::Instance().AddCollection( &this->privData->guiElements );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,10 @@ bool LobbyState::Render( )
|
||||||
Graphics::API::StartGuiRender();
|
Graphics::API::StartGuiRender();
|
||||||
|
|
||||||
Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) );
|
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();
|
Graphics::API::EndFrame();
|
||||||
return true;
|
return true;
|
||||||
|
@ -139,7 +142,7 @@ void LobbyState::DataRecieved( NetEvent<NetworkClient*, NetworkClient::ClientEve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<GameClientState*>& e )
|
void OnButtonInteract_Ready( Oyster::Event::ButtonEvent<LobbyState*>& e )
|
||||||
{
|
{
|
||||||
switch( e.state )
|
switch( e.state )
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ struct MainState::MyData
|
||||||
GameClientState::ClientState nextState;
|
GameClientState::ClientState nextState;
|
||||||
NetworkClient *nwClient;
|
NetworkClient *nwClient;
|
||||||
Graphics::API::Texture background;
|
Graphics::API::Texture background;
|
||||||
EventButtonCollection button;
|
EventButtonCollection guiElements;
|
||||||
};
|
};
|
||||||
|
|
||||||
void OnButtonInteract_Create( Oyster::Event::ButtonEvent<MainState*>& e );
|
void OnButtonInteract_Create( Oyster::Event::ButtonEvent<MainState*>& e );
|
||||||
|
@ -53,16 +53,16 @@ bool MainState::Init( NetworkClient* nwClient )
|
||||||
ButtonRectangle<MainState*> *button;
|
ButtonRectangle<MainState*> *button;
|
||||||
|
|
||||||
button = new ButtonRectangle<MainState*>( 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 );
|
button = new ButtonRectangle<MainState*>( 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<MainState*>( 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 );
|
button = new ButtonRectangle<MainState*>( 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<MainState*>( 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 );
|
button = new ButtonRectangle<MainState*>( 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
|
// bind button collection to the singleton eventhandler
|
||||||
EventHandler::Instance().AddCollection( &this->privData->button );
|
EventHandler::Instance().AddCollection( &this->privData->guiElements );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -87,10 +87,10 @@ bool MainState::Render()
|
||||||
Graphics::API::StartGuiRender();
|
Graphics::API::StartGuiRender();
|
||||||
|
|
||||||
Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) );
|
Graphics::API::RenderGuiElement( this->privData->background, Float2(0.5f), Float2(1.0f) );
|
||||||
this->privData->button.RenderTexture();
|
this->privData->guiElements.RenderTexture();
|
||||||
|
|
||||||
Graphics::API::StartTextRender();
|
Graphics::API::StartTextRender();
|
||||||
this->privData->button.RenderText();
|
this->privData->guiElements.RenderText();
|
||||||
|
|
||||||
Graphics::API::EndFrame();
|
Graphics::API::EndFrame();
|
||||||
return true;
|
return true;
|
||||||
|
@ -101,7 +101,7 @@ bool MainState::Release()
|
||||||
if( this->privData )
|
if( this->privData )
|
||||||
{
|
{
|
||||||
Graphics::API::DeleteTexture( this->privData->background ); // TODO: @todo bug caught when exiting by X
|
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;
|
this->privData = NULL;
|
||||||
// button collection will be autoreleased from EventHandler
|
// button collection will be autoreleased from EventHandler
|
||||||
|
|
Loading…
Reference in New Issue