# HG changeset patch # User koryspansel # Date 1316143875 25200 # Node ID 502ed0a0059a2a74d8816486f35f71d342605348 # Parent b4dc5d674e22b2be3599ce5088cd75ccace90e91 Hooking up Gui elements diff -r b4dc5d674e22 -r 502ed0a0059a LightClone/Source/World.cpp --- a/LightClone/Source/World.cpp Thu Sep 15 18:42:12 2011 -0700 +++ b/LightClone/Source/World.cpp Thu Sep 15 20:31:15 2011 -0700 @@ -11,7 +11,7 @@ /* * World */ -World::World() : kToolbar(8), kMain(16), kFunction(8), kControls(4) +World::World() : kToolbar(8), kMain(16), kFunction(8)//, kControls(4) { nGameState = GameState_Active; nSimulationState = SimulationState_Idle; @@ -62,9 +62,11 @@ kFunction.Add(1023.0f + 2 * 54.0f, 501.0f + 1 * 54.0f, 48.0f, 48.0f); kFunction.Add(1023.0f + 3 * 54.0f, 501.0f + 1 * 54.0f, 48.0f, 48.0f); + /* kControls.Add(1023.0f + 0.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); kControls.Add(1023.0f + 1.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); kControls.Add(1023.0f + 2.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); + */ } /* @@ -283,6 +285,37 @@ ErrorCode eCode = kInterface.Initialize(pResourceManager, pInputManager); if(eCode == Error_Success) { + GuiImage* pBackground = new GuiImage(); + pBackground->Initialize(pResourceManager); + pBackground->SetTexture("Data\\Textures\\Background01.tga", true); + pBackground->SetPosition(ScreenSizeX - pBackground->GetDimensions().x, 0.0f); + + GuiButton* pButtonPlay = new GuiButton(); + pButtonPlay->Initialize(pResourceManager); + pButtonPlay->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Play.tga", true); + pButtonPlay->SetPosition(1023.0f + 0.0f * 54.0f, 640.0f); + pButtonPlay->Subscribe(GuiButton::EventClick, &World::OnPlay, this); + + GuiButton* pButtonStop = new GuiButton(); + pButtonStop->Initialize(pResourceManager); + pButtonStop->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Stop.tga", true); + pButtonStop->SetPosition(1023.0f + 1.0f * 54.0f, 640.0f); + pButtonStop->Subscribe(GuiButton::EventClick, &World::OnStop, this); + + /* + GuiButton* pButtonReset = new GuiButton(); + pButtonReset->Initialize(pResourceManager); + pButtonReset->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Reset.tga", true); + pButtonReset->SetPosition(1023.0f + 2.0f * 54.0f, 640.0f.0f); + pButtonReset->Subscribe(GuiButton::EventClick, &World::OnReset, this); + */ + + GuiButton* pButtonExit = new GuiButton(); + pButtonExit->Initialize(pResourceManager); + pButtonExit->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Exit.tga", true); + pButtonExit->SetPosition(1023.0f + 3.0f * 54.0f, 640.0f); + pButtonExit->Subscribe(GuiButton::EventClick, &World::OnExit, this); + /* GuiLabel* pLabel = new GuiLabel(); @@ -293,22 +326,11 @@ pLabel->SetPosition(0.5f * ScreenSizeX, 0.5f * ScreenSizeY); */ - GuiImage* - pImage = new GuiImage(); - pImage->Initialize(pResourceManager); - pImage->SetTexture("Data\\Textures\\Background.tga", true); - pImage->SetPosition(0.5f * ScreenSizeX, 0.0f); - - GuiButton* - pButton = new GuiButton(); - pButton->Initialize(pResourceManager); - pButton->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Play.tga", true); - pButton->SetPosition(0.5f * ScreenSizeX, 0.75f * ScreenSizeY); - pButton->Subscribe(GuiButton::EventClick, &World::OnClick, this); - - //kInterface.Add(pLabel); - kInterface.Add(pImage); - kInterface.Add(pButton); + kInterface.Add(pBackground); + kInterface.Add(pButtonPlay); + kInterface.Add(pButtonStop); + //kInterface.Add(pButtonReset); + kInterface.Add(pButtonExit); /* //CodePanel* @@ -468,6 +490,7 @@ { if(pInputManager->IsButtonDown(0) && !pInputManager->WasButtonDown(0)) { + /* int32 nSelection = kControls.Pick(fMouseX, fMouseY); if(nSelection >= 0) { @@ -501,6 +524,7 @@ } } else + */ { // pick against the toolbar nSelection = kToolbar.Pick(fMouseX, fMouseY); @@ -690,9 +714,29 @@ } /* - * OnClick + * OnPlay + */ +void World::OnPlay(GuiEventArguments& kArguments) +{ +} + +/* + * OnStop */ -void World::OnClick(GuiEventArguments& kArguments) +void World::OnStop(GuiEventArguments& kArguments) +{ +} + +/* + * OnReset + */ +void World::OnReset(GuiEventArguments& kArguments) { - OutputDebugStringA("Button Clicked!\n"); } + +/* + * OnExit + */ +void World::OnExit(GuiEventArguments& kArguments) +{ +} diff -r b4dc5d674e22 -r 502ed0a0059a LightClone/Source/World.h --- a/LightClone/Source/World.h Thu Sep 15 18:42:12 2011 -0700 +++ b/LightClone/Source/World.h Thu Sep 15 20:31:15 2011 -0700 @@ -109,7 +109,7 @@ /* * kControlBounds */ - ButtonPane kControls; + //ButtonPane kControls; /* * kArrowBounds @@ -232,9 +232,24 @@ void ProcessInput(float fElapsed); /* - * OnClick + * OnPlay + */ + void OnPlay(GuiEventArguments& kArguments); + + /* + * OnStop */ - void OnClick(GuiEventArguments& kArguments); + void OnStop(GuiEventArguments& kArguments); + + /* + * OnReset + */ + void OnReset(GuiEventArguments& kArguments); + + /* + * OnExit + */ + void OnExit(GuiEventArguments& kArguments); }; #endif //__WORLD_H__