diff LightClone/Source/Interface.cpp @ 15:ee1c2510096d

Work on GUI system
author koryspansel <koryspansel@bendbroadband.com>
date Wed, 14 Sep 2011 11:04:18 -0700
parents 292e534f00c2
children 88f7c22e7b45
line wrap: on
line diff
--- a/LightClone/Source/Interface.cpp	Tue Sep 13 23:01:45 2011 -0700
+++ b/LightClone/Source/Interface.cpp	Wed Sep 14 11:04:18 2011 -0700
@@ -4,6 +4,7 @@
 
 #include "Interface.h"
 #include "VertexTypes.h"
+#include "InputManager.h"
 
 /*
  * pActionTextureName
@@ -59,7 +60,8 @@
 /*
  * Initialize
  */
-ErrorCode Interface::Initialize(ResourceManager* pManager)
+//ErrorCode Interface::Initialize(EventSystem* pSystem, ResourceManager* pManager)
+ErrorCode Interface::Initialize(InputManager* pInput, ResourceManager* pManager);
 {
 	ErrorCode eCode = pManager->CreateEffectFromFile("Data\\Shaders\\TexturedQuad.fx", &pEffect);
 	if(eCode != Error_Success)
@@ -140,6 +142,9 @@
 		return Error_Fail;
 	}
 
+	//pEventSystem = pSystem;
+	//pEventSystem->AddSink(this);
+
 	return SetupVertexBuffer();
 }
 
@@ -148,6 +153,9 @@
  */
 void Interface::Terminate()
 {
+	//pEventSystem->RemoveSink(this);
+	//pEventSystem = NULL;
+
 	if(pCursorTexture)
 	{
 		pCursorTexture->Release();
@@ -284,6 +292,36 @@
 }
 
 /*
+ * ProcessEvent
+ */
+int32 Interface::ProcessEvent(const Event& kEvent)
+{
+	//HACK: Only have one event struct at the moment
+	const InputEvent& kInputEvent = (const InputEvent&)kEvent;
+
+	if(kEvent.nType == InputEventType_KeyDown)
+	{
+		if(kInputEvent.nKey == DIK_SPACE)
+		{
+			OutputDebugStringA("Events!  Yay!\n");
+			return EventResult_Stop;
+		}
+	}
+	else
+
+	if(kEvent.nType == InputEventType_MouseMove)
+	{
+		char kBuffer[64];
+		sprintf_s(kBuffer, "%d %d\n", (int)kInputEvent.fX, (int)kInputEvent.fY);
+
+		OutputDebugStringA(kBuffer);
+		return EventResult_Stop;
+	}
+
+	return EventResult_Continue;
+}
+
+/*
  * SetupVertexBuffer
  */
 ErrorCode Interface::SetupVertexBuffer()