MainState fix

new compilation errors dealt with
This commit is contained in:
Dander7BD 2014-02-14 09:46:17 +01:00
parent 49fc55be60
commit d4139e265e
1 changed files with 14 additions and 11 deletions

View File

@ -28,9 +28,9 @@ struct MainState::MyData
EventButtonCollection button; EventButtonCollection button;
}; };
void OnButtonInteract_Create( Oyster::Event::ButtonEvent<GameClientState*>& e ); void OnButtonInteract_Create( Oyster::Event::ButtonEvent<MainState*>& e );
void OnButtonInteract_Join( Oyster::Event::ButtonEvent<GameClientState*>& e ); void OnButtonInteract_Join( Oyster::Event::ButtonEvent<MainState*>& e );
void OnButtonInteract_Quit( Oyster::Event::ButtonEvent<GameClientState*>& e ); void OnButtonInteract_Quit( Oyster::Event::ButtonEvent<MainState*>& e );
MainState::MainState(void) {} MainState::MainState(void) {}
@ -50,15 +50,15 @@ bool MainState::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<MainState*> *button;
button = new ButtonRectangle<GameClientState*>( L"earth_md.png", OnButtonInteract_Create, this, 0.5f, 0.2f, 0.3f, 0.1f, true ); 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->button.AddButton( button );
button = new ButtonRectangle<GameClientState*>( L"skysphere_md.png", OnButtonInteract_Join, this, 0.5f, 0.4f, 0.3f, 0.1f, true ); 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->button.AddButton( button );
button = new ButtonRectangle<GameClientState*>( L"plane_texture_md.png", OnButtonInteract_Quit, this, 0.5f, 0.8f, 0.3f, 0.1f, true ); 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->button.AddButton( button );
// bind button collection to the singleton eventhandler // bind button collection to the singleton eventhandler
@ -87,7 +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.Render(); this->privData->button.RenderTexture();
Graphics::API::StartTextRender();
this->privData->button.RenderText();
Graphics::API::EndFrame(); Graphics::API::EndFrame();
return true; return true;
@ -111,7 +114,7 @@ void MainState::ChangeState( ClientState next )
this->privData->nextState = next; this->privData->nextState = next;
} }
void OnButtonInteract_Create( Oyster::Event::ButtonEvent<GameClientState*>& e ) void OnButtonInteract_Create( Oyster::Event::ButtonEvent<MainState*>& e )
{ {
switch( e.state ) switch( e.state )
{ {
@ -122,7 +125,7 @@ void OnButtonInteract_Create( Oyster::Event::ButtonEvent<GameClientState*>& e )
} }
} }
void OnButtonInteract_Join( Oyster::Event::ButtonEvent<GameClientState*>& e ) void OnButtonInteract_Join( Oyster::Event::ButtonEvent<MainState*>& e )
{ {
switch( e.state ) switch( e.state )
{ {
@ -133,7 +136,7 @@ void OnButtonInteract_Join( Oyster::Event::ButtonEvent<GameClientState*>& e )
} }
} }
void OnButtonInteract_Quit( Oyster::Event::ButtonEvent<GameClientState*>& e ) void OnButtonInteract_Quit( Oyster::Event::ButtonEvent<MainState*>& e )
{ {
switch( e.state ) switch( e.state )
{ {