changeset 22:502ed0a0059a

Hooking up Gui elements
author koryspansel <koryspansel@bendbroadband.com>
date Thu, 15 Sep 2011 20:31:15 -0700
parents b4dc5d674e22
children a785b0aaf004
files LightClone/Source/World.cpp LightClone/Source/World.h
diffstat 2 files changed, 82 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- 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)
+{
+}
--- 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__