changeset 24:4ee162fc3537

More Gui work; Added new button states
author koryspansel <koryspansel@bendbroadband.com>
date Fri, 16 Sep 2011 09:29:53 -0700
parents a785b0aaf004
children eae13b04b06f
files Assets/UI/Background02.PSD Assets/UI/ButtonD.PSD Assets/UI/ButtonH.PSD Assets/UI/ButtonN.PSD Assets/UI/Dialog0.PSD Data/Textures/ButtonD.tga Data/Textures/ButtonH.tga Data/Textures/ButtonN.tga Data/Textures/Dialog0.tga LightClone/LightClone.vcproj LightClone/Source/Interface.cpp LightClone/Source/Interface.h LightClone/Source/Mediator.h LightClone/Source/World.cpp LightClone/ToDo.txt
diffstat 15 files changed, 21 insertions(+), 892 deletions(-) [+]
line wrap: on
line diff
Binary file Assets/UI/Background02.PSD has changed
Binary file Assets/UI/ButtonD.PSD has changed
Binary file Assets/UI/ButtonH.PSD has changed
Binary file Assets/UI/ButtonN.PSD has changed
Binary file Assets/UI/Dialog0.PSD has changed
Binary file Data/Textures/ButtonD.tga has changed
Binary file Data/Textures/ButtonH.tga has changed
Binary file Data/Textures/ButtonN.tga has changed
Binary file Data/Textures/Dialog0.tga has changed
--- a/LightClone/LightClone.vcproj	Thu Sep 15 21:45:00 2011 -0700
+++ b/LightClone/LightClone.vcproj	Fri Sep 16 09:29:53 2011 -0700
@@ -277,10 +277,6 @@
 				>
 			</File>
 			<File
-				RelativePath=".\Source\Interface.cpp"
-				>
-			</File>
-			<File
 				RelativePath=".\Source\Loader.cpp"
 				>
 			</File>
@@ -447,10 +443,6 @@
 				>
 			</File>
 			<File
-				RelativePath=".\Source\Interface.h"
-				>
-			</File>
-			<File
 				RelativePath=".\Source\Loader.h"
 				>
 			</File>
--- a/LightClone/Source/Interface.cpp	Thu Sep 15 21:45:00 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,715 +0,0 @@
-/*
- * Interface
- */
-
-#include "Interface.h"
-#include "VertexTypes.h"
-#include "InputManager.h"
-
-/*
- * pActionTextureName
- */
-static const char* pActionTextureName[] = 
-{
-	"Data\\Textures\\Forward.tga",
-	"Data\\Textures\\RotateCW.tga",
-	"Data\\Textures\\RotateCCW.tga",
-	"Data\\Textures\\Jump.tga",
-	"Data\\Textures\\Light.tga",
-	"Data\\Textures\\Function1.tga",
-	"Data\\Textures\\Function2.tga",
-};
-
-/*
- * pControlTextureName
- */
-const char* pControlTextureName[] =
-{
-	"Data\\Textures\\Play.tga",
-	"Data\\Textures\\Stop.tga",
-	"Data\\Textures\\Exit.tga",
-};
-
-/*
- * pArrowTextureName
- */
-const char* pArrowTextureName[] =
-{
-	"Data\\Textures\\Left.tga",
-	"Data\\Textures\\Right.tga",
-};
-
-/*
- * Interface
- */
-Interface::Interface()
-{
-	pEffect				= NULL;
-	pFont				= NULL;
-	pVertexBuffer		= NULL;
-	pBackgroundTexture	= NULL;
-	pCursorTexture		= NULL;
-	pDialog1Texture		= NULL;
-	pDialog2Texture		= NULL;
-
-	memset(pActionTexture, 0, sizeof(pActionTexture));
-	memset(pControlTexture, 0, sizeof(pControlTexture));
-	memset(pArrowTexture, 0, sizeof(pArrowTexture));
-}
-
-/*
- * Initialize
- */
-//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)
-	{
-		Terminate();
-		return Error_Fail;
-	}
-
-	eCode = pManager->CreateFontFromName("Courier New", 18, FW_BOLD, &pFont);
-	if(eCode != Error_Success)
-	{
-		Terminate();
-		return Error_Fail;
-	}
-
-	eCode = pManager->CreateVertexBuffer(TrianglesPerFace * VerticesPerTriangle * sizeof(Vertex::Quad), D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED, &pVertexBuffer);
-	if(eCode != Error_Success)
-	{
-		Terminate();
-		return Error_Fail;
-	}
-
-	eCode = pManager->CreateTextureFromFile("Data\\Textures\\Background00.tga", &pBackgroundTexture);
-	if(eCode != Error_Success)
-	{
-		Terminate();
-		return Error_Fail;
-	}
-
-	for(uint32 i = 0; i < Action_Count; ++i)
-	{
-		eCode = pManager->CreateTextureFromFile(pActionTextureName[i], pActionTexture + i);
-		if(eCode != Error_Success)
-		{
-			Terminate();
-			return Error_Fail;
-		}
-	}
-
-	for(uint32 i = 0; i < sizeof(pControlTextureName) / sizeof(pControlTextureName[0]); ++i)
-	{
-		eCode = pManager->CreateTextureFromFile(pControlTextureName[i], pControlTexture + i);
-		if(eCode != Error_Success)
-		{
-			Terminate();
-			return Error_Fail;
-		}
-	}
-
-	for(uint32 i = 0; i < sizeof(pArrowTextureName) / sizeof(pArrowTextureName[0]); ++i)
-	{
-		eCode = pManager->CreateTextureFromFile(pArrowTextureName[i], pArrowTexture + i);
-		if(eCode != Error_Success)
-		{
-			Terminate();
-			return Error_Fail;
-		}
-	}
-
-	eCode = pManager->CreateTextureFromFile("Data\\Textures\\Dialog1.tga", &pDialog1Texture);
-	if(eCode != Error_Success)
-	{
-		Terminate();
-		return Error_Fail;
-	}
-
-	eCode = pManager->CreateTextureFromFile("Data\\Textures\\Dialog2.tga", &pDialog2Texture);
-	if(eCode != Error_Success)
-	{
-		Terminate();
-		return Error_Fail;
-	}
-
-	eCode = pManager->CreateTextureFromFile("Data\\Textures\\Arrow.tga", &pCursorTexture);
-	if(eCode != Error_Success)
-	{
-		Terminate();
-		return Error_Fail;
-	}
-
-	//pEventSystem = pSystem;
-	//pEventSystem->AddSink(this);
-
-	return SetupVertexBuffer();
-}
-
-/* 
- * Terminate
- */
-void Interface::Terminate()
-{
-	//pEventSystem->RemoveSink(this);
-	//pEventSystem = NULL;
-
-	if(pCursorTexture)
-	{
-		pCursorTexture->Release();
-		pCursorTexture = NULL;
-	}
-
-	if(pDialog1Texture)
-	{
-		pDialog1Texture->Release();
-		pDialog1Texture = NULL;
-	}
-
-	if(pDialog2Texture)
-	{
-		pDialog2Texture->Release();
-		pDialog2Texture = NULL;
-	}
-
-	for(uint32 i = 0; i < sizeof(pArrowTexture) / sizeof(pArrowTexture[0]); ++i)
-	{
-		if(pArrowTexture[i])
-		{
-			pArrowTexture[i]->Release();
-			pArrowTexture[i] = NULL;
-		}
-	}
-
-	for(uint32 i = 0; i < sizeof(pControlTexture) / sizeof(pControlTexture[0]); ++i)
-	{
-		if(pControlTexture[i])
-		{
-			pControlTexture[i]->Release();
-			pControlTexture[i] = NULL;
-		}
-	}
-
-	for(uint32 i = 0; i < Action_Count; ++i)
-	{
-		if(pActionTexture[i])
-		{
-			pActionTexture[i]->Release();
-			pActionTexture[i] = NULL;
-		}
-	}
-
-	if(pBackgroundTexture)
-	{
-		pBackgroundTexture->Release();
-		pBackgroundTexture = NULL;
-	}
-
-	if(pVertexBuffer)
-	{
-		pVertexBuffer->Release();
-		pVertexBuffer = NULL;
-	}
-
-	if(pFont)
-	{
-		pFont->Release();
-		pFont = NULL;
-	}
-
-	if(pEffect)
-	{
-		pEffect->Release();
-		pEffect = NULL;
-	}
-}
-
-/*
- * Render
- */
-void Interface::Render(RenderContext& kContext, Camera& kCamera)
-{
-	/*
-	if(pModel->nGameState != GameState_Exit)
-	{
-		kContext.SetupCamera2D(pEffect);
-
-		uint32 nPasses = 0;
-
-		pEffect->SetTechnique(pEffect->GetTechnique(0));
-		pEffect->Begin(&nPasses, 0);
-		pEffect->BeginPass(0);
-
-		RenderBackground(kContext, pModel);
-		RenderToolbar(kContext, pModel);
-		RenderMain(kContext, pModel);
-		RenderFunctions(kContext, pModel);
-		RenderControls(kContext, pModel);
-
-		if(pModel->nGameState == GameState_Active)
-		{
-		}
-		else
-
-		if(pModel->nGameState == GameState_Complete)
-		{
-			char kMessage[256];
-			sprintf_s(kMessage, "Congratulations!\nYou have completed level %d", pModel->nCurrentLevel);
-
-			RenderDialog(kContext, pModel, kMessage, "Ok");
-
-			//TODO: This would occur before entering the complete state:
-			//pLevelDialog->SetMessage(kMessage);
-			//pLevelDialog->SetVisible(true);
-			//
-			//nGameState = GameState_Complete;
-		}
-		else
-
-		if(pModel->nGameState == GameState_Over)
-		{
-			const char* pMessage = "Congratulations!\nYou have won the game!";
-
-			RenderDialog(kContext, pModel, pMessage, "Ok");
-		}
-		else
-
-		if(pModel->nGameState == GameState_Confirm)
-		{
-			const char* pMessage = "Are you sure you want to quit the game?";
-
-			RenderDialog(kContext, pModel, pMessage, "Yes", "No");
-		}
-
-		RenderCursor(kContext, pModel);
-
-		pEffect->EndPass();
-		pEffect->End();
-	}
-	*/
-}
-
-/*
- * 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()
-{
-	Vertex::Quad* pVertices = NULL;
-
-	HRESULT hResult = pVertexBuffer->Lock(0, 0, (void**)&pVertices, D3DLOCK_DISCARD);
-	if(FAILED(hResult))
-	{
-		return Error_Fail;
-	}
-
-	pVertices[0]	= Vertex::Quad(+0.0f, -1.0f, 1.0f, 0.0f, 1.0f);
-	pVertices[1]	= Vertex::Quad(+0.0f, +0.0f, 1.0f, 0.0f, 0.0f);
-	pVertices[2]	= Vertex::Quad(+1.0f, +0.0f, 1.0f, 1.0f, 0.0f);
-	pVertices[3]	= Vertex::Quad(+0.0f, -1.0f, 1.0f, 0.0f, 1.0f);
-	pVertices[4]	= Vertex::Quad(+1.0f, +0.0f, 1.0f, 1.0f, 0.0f);
-	pVertices[5]	= Vertex::Quad(+1.0f, -1.0f, 1.0f, 1.0f, 1.0f);
-
-	pVertexBuffer->Unlock();
-
-	return Error_Success;
-}
-
-/*
- * RenderBackground
- */
-void Interface::RenderBackground(RenderContext& kContext)
-{
-	/*
-	const D3DXVECTOR4 kColorVector(1.0f, 1.0f, 1.0f, 1.0f);
-
-	D3DSURFACE_DESC kDescriptor;
-	pBackgroundTexture->GetLevelDesc(0, &kDescriptor);
-
-	const float fX = ScreenSizeX - (float)kDescriptor.Width;
-	const float fY = 0.0f;
-
-	D3DXMATRIX kScale;
-	D3DXMatrixScaling(&kScale, (float)kDescriptor.Width, (float)kDescriptor.Height, 1.0f);
-
-	D3DXMATRIX kTranslate;
-	D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + fX + 0.5f, 0.5f * ScreenSizeY - fY + 0.5f, 0.0f);
-
-	D3DXMATRIX kWorldMatrix;
-	D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
-
-	pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix);
-	pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &kColorVector);
-	pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pBackgroundTexture);
-	pEffect->CommitChanges();
-
-	kContext.DrawTriangles(Vertex::Quad::Declaration, pVertexBuffer, sizeof(Vertex::Quad), TrianglesPerFace);
-	*/
-}
-
-/*
- * RenderToolbar
- */
-void Interface::RenderToolbar(RenderContext& kContext)
-{
-	/*
-	const D3DXVECTOR4 kColorVector(1.0f, 1.0f, 1.0f, 1.0f);
-
-	for(uint32 i = 0; i < Action_Count; ++i)
-	{
-		const Rectangle2& kBounds = pModel->kToolbar.GetBounds(i);
-
-		D3DXMATRIX kScale;
-		D3DXMatrixScaling(&kScale, kBounds.Width, kBounds.Height, 1.0f);
-
-		D3DXMATRIX kTranslate;
-		D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + kBounds.X, 0.5f * ScreenSizeY - kBounds.Y, 0.0f);
-
-		D3DXMATRIX kWorldMatrix;
-		D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
-
-		pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix);
-		pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &kColorVector);
-		pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pActionTexture[i]);
-		pEffect->CommitChanges();
-
-		kContext.DrawTriangles(Vertex::Quad::Declaration, pVertexBuffer, sizeof(Vertex::Quad), TrianglesPerFace);
-	}
-	*/
-}
-
-/*
- * RenderMain
- */
-void Interface::RenderMain(RenderContext& kContext)
-{
-	/*
-	Code* pCode = pModel->GetFunction(0);
-	if(pCode)
-	{
-		const D3DXVECTOR4 kColorVector(1.0f, 1.0f, 1.0f, 1.0f);
-
-		for(uint32 i = 0; i < Max(pCode->GetSize(), pModel->kMain.GetMaximum()); ++i)
-		{
-			const uint32 nAction = pCode->GetSlot(i);
-
-			if(Action_Forward <= nAction && nAction <= Action_FunctionB)
-			{
-				const Rectangle2& kBounds = pModel->kMain.GetBounds(i);
-
-				D3DXMATRIX kScale;
-				D3DXMatrixScaling(&kScale, kBounds.Width, kBounds.Height, 1.0f);
-
-				D3DXMATRIX kTranslate;
-				D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + kBounds.X, 0.5f * ScreenSizeY - kBounds.Y, 0.0f);
-
-				D3DXMATRIX kWorldMatrix;
-				D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
-
-				pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix);
-				pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &kColorVector);
-				pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pActionTexture[nAction - Action_Forward]);
-				pEffect->CommitChanges();
-
-				kContext.DrawTriangles(Vertex::Quad::Declaration, pVertexBuffer, sizeof(Vertex::Quad), TrianglesPerFace);
-			}
-		}
-
-		RECT kRectangle;
-		kRectangle.left		= 1008;
-		kRectangle.top		= 199;
-		kRectangle.right	= kRectangle.left + 200;
-		kRectangle.bottom	= kRectangle.top + 200; 
-
-		pFont->DrawTextA(NULL, "Main", -1, &kRectangle, 0, D3DCOLOR_XRGB(0, 0, 0));
-	}
-	*/
-}
-
-/*
- * RenderFunctions
- */
-void Interface::RenderFunctions(RenderContext& kContext)
-{
-	/*
-	Code* pCode = pModel->GetFunction(pModel->nCurrentFunction + 1);
-	if(pCode)
-	{
-		const D3DXVECTOR4 kColorVector(1.0f, 1.0f, 1.0f, 1.0f);
-
-		//TODO: Need to draw slots first, then action
-
-		for(uint32 i = 0; i < Max(pCode->GetSize(), pModel->kFunction.GetMaximum()); ++i)
-		{
-			const uint32 nAction = pCode->GetSlot(i);
-
-			if(Action_Forward <= nAction && nAction <= Action_FunctionB)
-			{
-				const Rectangle2& kBounds = pModel->kFunction.GetBounds(i);
-
-				D3DXMATRIX kScale;
-				D3DXMatrixScaling(&kScale, kBounds.Width, kBounds.Height, 1.0f);
-
-				D3DXMATRIX kTranslate;
-				D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + kBounds.X, 0.5f * ScreenSizeY - kBounds.Y, 0.0f);
-
-				D3DXMATRIX kWorldMatrix;
-				D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
-
-				pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix);
-				pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &kColorVector);
-				pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pActionTexture[nAction - Action_Forward]);
-				pEffect->CommitChanges();
-
-				kContext.DrawTriangles(Vertex::Quad::Declaration, pVertexBuffer, sizeof(Vertex::Quad), TrianglesPerFace);
-			}
-		}
-
-		for(uint32 i = 0; i < sizeof(pModel->kArrowBounds) / sizeof(pModel->kArrowBounds[0]); ++i)
-		{
-			D3DXMATRIX kScale;
-			D3DXMatrixScaling(&kScale, pModel->kArrowBounds[i].Width, pModel->kArrowBounds[i].Height, 1.0f);
-
-			D3DXMATRIX kTranslate;
-			D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + pModel->kArrowBounds[i].X, 0.5f * ScreenSizeY - pModel->kArrowBounds[i].Y, 0.0f);
-
-			D3DXMATRIX kWorldMatrix;
-			D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
-
-			pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix);
-			pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &kColorVector);
-			pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pArrowTexture[i]);
-			pEffect->CommitChanges();
-
-			kContext.DrawTriangles(Vertex::Quad::Declaration, pVertexBuffer, sizeof(Vertex::Quad), TrianglesPerFace);
-		}
-
-		RECT kRectangle;
-
-		kRectangle.left		= 1008;
-		kRectangle.top		= 472;
-		kRectangle.right	= kRectangle.left + 200;
-		kRectangle.bottom	= kRectangle.top + 200; 
-
-		pFont->DrawTextA(NULL, "Function", -1, &kRectangle, 0, D3DCOLOR_XRGB(0, 0, 0));
-
-		char kBuffer[16];
-		sprintf_s(kBuffer, "%d", pModel->nCurrentFunction + 1);
-
-		kRectangle.left		= 1225;
-		kRectangle.top		= 473;
-		kRectangle.right	= kRectangle.left + 200;
-		kRectangle.bottom	= kRectangle.top + 200; 
-
-		pFont->DrawTextA(NULL, kBuffer, -1, &kRectangle, 0, D3DCOLOR_XRGB(0, 0, 0));
-	}
-	*/
-}
-
-/*
- * RenderControls
- */
-void Interface::RenderControls(RenderContext& kContext)
-{
-	/*
-	const D3DXVECTOR4 kColorVector(1.0f, 1.0f, 1.0f, 1.0f);
-
-	for(uint32 i = 0; i < pModel->kControls.GetSize(); ++i)
-	{
-		const Rectangle2& kBounds = pModel->kControls.GetBounds(i);
-
-		D3DXMATRIX kScale;
-		D3DXMatrixScaling(&kScale, kBounds.Width, kBounds.Height, 1.0f);
-
-		D3DXMATRIX kTranslate;
-		D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + kBounds.X, 0.5f * ScreenSizeY - kBounds.Y, 0.0f);
-
-		D3DXMATRIX kWorldMatrix;
-		D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
-
-		pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix);
-		pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &kColorVector);
-		pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pControlTexture[i]);
-		pEffect->CommitChanges();
-
-		kContext.DrawTriangles(Vertex::Quad::Declaration, pVertexBuffer, sizeof(Vertex::Quad), TrianglesPerFace);
-	}
-	*/
-}
-
-/*
- * RenderDialog
- */
-void Interface::RenderDialog(RenderContext& kContext, const char* pMessage, const char* pChoiceA, const char* pChoiceB)
-{
-	/*
-	if(pMessage && pChoiceA)
-	{
-		IDirect3DTexture9* pDialogTexture = pChoiceB ? pDialog2Texture : pDialog1Texture;
-
-		D3DSURFACE_DESC kDescriptor;
-		pDialogTexture->GetLevelDesc(0, &kDescriptor);
-
-		const float fSizeX	= (float)kDescriptor.Width;
-		const float fSizeY	= (float)kDescriptor.Height;
-
-		{
-			D3DXMATRIX kScale;
-			D3DXMatrixScaling(&kScale, fSizeX, fSizeY, 1.0f);
-
-			D3DXMATRIX kTranslate;
-			D3DXMatrixTranslation(&kTranslate, -0.5f * fSizeX, 0.5f * fSizeY, 0.0f);
-
-			D3DXMATRIX kWorldMatrix;
-			D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
-
-			pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix);
-			pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pDialogTexture);
-			pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &D3DXVECTOR4(1.0f, 1.0f, 1.0f, 1.0f));
-			pEffect->CommitChanges();
-
-			kContext.DrawTriangles(Vertex::Quad::Declaration, pVertexBuffer, sizeof(Vertex::Quad), TrianglesPerFace);
-		}
-
-		#if 0
-		{
-			D3DXMATRIX kScale;
-			D3DXMatrixScaling(&kScale, pModel->kDialog1Bounds[0].Width, pModel->kDialog1Bounds[0].Height, 1.0f);
-
-			D3DXMATRIX kTranslate;
-			D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + pModel->kDialog1Bounds[0].X, 0.5f * ScreenSizeY - pModel->kDialog1Bounds[0].Y, 0.0f);
-
-			D3DXMATRIX kWorldMatrix;
-			D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
-
-			pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix);
-			pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pTexture);
-			pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &D3DXVECTOR4(1.0f, 1.0f, 1.0f, 1.0f));
-			pEffect->CommitChanges();
-
-			kContext.DrawTriangles(Vertex::Quad::Declaration, pVertexBuffer, sizeof(Vertex::Quad), TrianglesPerFace);
-		}
-		#endif
-
-		RECT kRectangle;
-
-		kRectangle.left		= ScreenSizeX / 2;
-		kRectangle.top		= ScreenSizeY / 2 - 24;
-		kRectangle.right	= ScreenSizeX / 2;
-		kRectangle.bottom	= ScreenSizeY / 2 - 24;
-
-		pFont->DrawTextA(NULL, pMessage, -1, &kRectangle, DT_CENTER | DT_VCENTER | DT_CALCRECT, D3DCOLOR_XRGB(0, 0, 0));
-		pFont->DrawTextA(NULL, pMessage, -1, &kRectangle, DT_CENTER | DT_VCENTER, D3DCOLOR_XRGB(0, 0, 0));
-
-		kRectangle.left		= (int32)pModel->kDialog1Bounds[0].X;
-		kRectangle.right	= (int32)(pModel->kDialog1Bounds[0].X + pModel->kDialog1Bounds[0].Width);
-		kRectangle.top		= (int32)pModel->kDialog1Bounds[0].Y;
-		kRectangle.bottom	= (int32)(pModel->kDialog1Bounds[0].Y + pModel->kDialog1Bounds[0].Height);
-
-		pFont->DrawTextA(NULL, pChoiceA, -1, &kRectangle, DT_CENTER | DT_VCENTER, D3DCOLOR_XRGB(0, 0, 0));
-
-		if(pChoiceB)
-		{
-		}
-	}
-	*/
-}
-
-/*
- * RenderCursor
- */
-void Interface::RenderCursor(RenderContext& kContext)
-{
-	/*
-	const D3DXVECTOR4 kColorVector(1.0f, 1.0f, 1.0f, 1.0f);
-
-	if(pCursorTexture)
-	{
-		const float fMouseX = pModel->kInputManager.GetMouseX();
-		const float fMouseY = pModel->kInputManager.GetMouseY();
-
-		if(pModel->kDragController.IsActive())
-		{
-			const uint32 nAction = pModel->kDragController.GetParameter() - Action_Forward;
-
-			D3DSURFACE_DESC kDescriptor;
-			pActionTexture[nAction]->GetLevelDesc(0, &kDescriptor);
-
-			const float fSizeX = (float)kDescriptor.Width;
-			const float fSizeY = (float)kDescriptor.Height;
-
-			D3DXMATRIX kScale;
-			D3DXMatrixScaling(&kScale, fSizeX, fSizeY, 1.0f);
-
-			D3DXMATRIX kTranslate;
-			D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + (fMouseX - 0.5f * fSizeX) + 0.5f, 0.5f * ScreenSizeY - (fMouseY - 0.5f * fSizeY) + 0.5f, 0.0f);
-
-			D3DXMATRIX kWorldMatrix;
-			D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
-
-			pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix);
-			pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &kColorVector);
-			pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pActionTexture[nAction]);
-			pEffect->CommitChanges();
-
-			kContext.DrawTriangles(Vertex::Quad::Declaration, pVertexBuffer, sizeof(Vertex::Quad), TrianglesPerFace);
-		}
-
-		D3DSURFACE_DESC kDescriptor;
-		pCursorTexture->GetLevelDesc(0, &kDescriptor);
-
-		D3DXMATRIX kScale;
-		D3DXMatrixScaling(&kScale, (float)kDescriptor.Width, (float)kDescriptor.Height, 1.0f);
-
-		D3DXMATRIX kTranslate;
-		D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + fMouseX + 0.5f, 0.5f * ScreenSizeY - fMouseY + 0.5f, 0.0f);
-
-		D3DXMATRIX kWorldMatrix;
-		D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
-
-		pEffect->SetMatrix(pEffect->GetParameterByName(NULL, "kWorld"), &kWorldMatrix);
-		pEffect->SetVector(pEffect->GetParameterByName(NULL, "kColor"), &kColorVector);
-		pEffect->SetTexture(pEffect->GetParameterByName(NULL, "kTexture"), pCursorTexture);
-		pEffect->CommitChanges();
-
-		kContext.DrawTriangles(Vertex::Quad::Declaration, pVertexBuffer, sizeof(Vertex::Quad), TrianglesPerFace);
-	}
-	*/
-}
-
-
-/*
-Drag & Drop Handling:
-	1.	Separate into 2 stages: drag detection and drop detection
-*/
\ No newline at end of file
--- a/LightClone/Source/Interface.h	Thu Sep 15 21:45:00 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/*
- * Interface
- */
-
-#ifndef __INTERFACE_H__
-#define __INTERFACE_H__
-
-#include "Core.h"
-#include "RenderContext.h"
-#include "ResourceManager.h"
-#include "EventSystem.h"
-#include "InputManager.h"
-
-/*
- * Interface
- */
-class Interface : public EventSink
-{
-private:
-
-	/*
-	 * pEventSystem
-	 */
-	EventSystem* pEventSystem;
-
-	/*
-	 * pEffect
-	 */
-	ID3DXEffect* pEffect;
-
-	/*
-	 * pFont
-	 */
-	ID3DXFont* pFont;
-
-	/*
-	 * pVertexBuffer
-	 */
-	IDirect3DVertexBuffer9* pVertexBuffer;
-
-	/*
-	 * pBackgroundTexture
-	 */
-	IDirect3DTexture9* pBackgroundTexture;
-
-	/*
-	 * pActionTexture
-	 */
-	IDirect3DTexture9* pActionTexture[Action_Count];
-
-	/*
-	 * pControlTexture
-	 */
-	IDirect3DTexture9* pControlTexture[3];
-
-	/*
-	 * pArrowTexture
-	 */
-	IDirect3DTexture9* pArrowTexture[2];
-
-	/*
-	 * pDialog1Texture
-	 */
-	IDirect3DTexture9* pDialog1Texture;
-
-	/*
-	 * pDialog2Texture
-	 */
-	IDirect3DTexture9* pDialog2Texture;
-
-	/*
-	 * pCursorTexture
-	 */
-	IDirect3DTexture9* pCursorTexture;
-
-public:
-
-	/*
-	 * Interface
-	 */
-	Interface();
-
-	/*
-	 * Initialize
-	 */
-	//ErrorCode Initialize(EventSystem* pSystem, ResourceManager* pManager);
-	ErrorCode Initialize(InputManager* pInput, ResourceManager* pManager);
-
-	/* 
-	 * Terminate
-	 */
-	void Terminate();
-
-	/*
-	 * Render
-	 */
-	void Render(RenderContext& kContext, Camera& kCamera);
-
-	/*
-	 * ProcessEvent
-	 */
-	virtual int32 ProcessEvent(const Event& kEvent);
-
-private:
-
-	/*
-	 * SetupVertexBuffer
-	 */
-	ErrorCode SetupVertexBuffer();
-
-	/*
-	 * RenderBackground
-	 */
-	void RenderBackground(RenderContext& kContext);
-
-	/*
-	 * RenderToolbar
-	 */
-	void RenderToolbar(RenderContext& kContext);
-
-	/*
-	 * RenderMain
-	 */
-	void RenderMain(RenderContext& kContext);
-
-	/*
-	 * RenderFunctions
-	 */
-	void RenderFunctions(RenderContext& kContext);
-
-	/*
-	 * RenderControls
-	 */
-	void RenderControls(RenderContext& kContext);
-
-	/*
-	 * RenderDialog
-	 */
-	void RenderDialog(RenderContext& kContext, const char* pMessage, const char* pChoiceA, const char* pChoiceB = NULL);
-
-	/*
-	 * RenderCursor
-	 */
-	void RenderCursor(RenderContext& kContext);
-};
-
-#endif //__INTERFACE_H__
--- a/LightClone/Source/Mediator.h	Thu Sep 15 21:45:00 2011 -0700
+++ b/LightClone/Source/Mediator.h	Fri Sep 16 09:29:53 2011 -0700
@@ -9,15 +9,10 @@
 #include "Clock.h"
 #include "Window.h"
 #include "InputManager.h"
-#include "World.h"
-#include "DragController.h"
-#include "ButtonPane.h"
-#include "Dialog.h"
 #include "GraphicsDevice.h"
 #include "ResourceManager.h"
 #include "RenderContext.h"
-#include "CameraController.h"
-#include "Interface.h"
+#include "World.h"
 
 /*
  * Mediator
--- a/LightClone/Source/World.cpp	Thu Sep 15 21:45:00 2011 -0700
+++ b/LightClone/Source/World.cpp	Fri Sep 16 09:29:53 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)
 {
 	nGameState				= GameState_Active;
 	nSimulationState		= SimulationState_Idle;
@@ -322,17 +322,18 @@
 
 		pLevelDialog = new GuiImage();
 		pLevelDialog->Initialize(pResourceManager);
-		//pLevelDialog->SetVisible(false);
-		pLevelDialog->SetTexture("Data\\Textures\\Dialog2.tga", true);
+		pLevelDialog->SetVisible(false);
+		pLevelDialog->SetTexture("Data\\Textures\\Dialog0.tga", true);
 		pLevelDialog->SetPosition(0.5f * (ScreenSizeX - pLevelDialog->GetWidth()), 0.5f * (ScreenSizeY - pLevelDialog->GetHeight()));
 
 		pLevelDialogOk = new GuiButton();
 		pLevelDialogOk->Initialize(pResourceManager);
-		pLevelDialogOk->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Slot.tga");
+		pLevelDialogOk->SetTexture(GuiButtonState_Normal, "Data\\Textures\\ButtonN.tga");
+		pLevelDialogOk->SetTexture(GuiButtonState_Hover, "Data\\Textures\\ButtonH.tga");
+		pLevelDialogOk->SetTexture(GuiButtonState_Down, "Data\\Textures\\ButtonD.tga");
 		pLevelDialogOk->SetFont("Courier New", 24);
 		pLevelDialogOk->SetText("Ok");
 		pLevelDialogOk->SetDimensions(150.0f, 52.0f);
-		//pLevelDialogOk->SetPosition(23.0f, 171.0f);
 		pLevelDialogOk->SetPosition(0.5f * (pLevelDialog->GetWidth() - pLevelDialogOk->GetWidth()), 171.0f);
 		pLevelDialogOk->Subscribe(GuiButton::EventClick, &World::OnExit, this);
 
@@ -342,15 +343,15 @@
 		pGameDialogOk = new GuiButton();
 		pGameDialogOk->Initialize(pResourceManager);
 		pGameDialogOk->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Button.tga", true);
-		//pGameDialogOk->SetText("Ok");
-		pGameDialogOk->SetPosition(1023.0f + 3.0f * 54.0f, 640.0f);
-		pGameDialogOk->Subscribe(GuiButton::EventClick, &World::OnExit, this);
+		pGameDialogOk->SetText("Ok");
+		pGameDialogOk->SetPosition(0.5f * (pGameDialog->GetWidth() - pGameDialogOk->GetWidth()), 171.0f);
+		pGameDialogOk->Subscribe(GuiButton::EventClick, &World::OnOk, this);
 		*/
 
 		pGameDialog = new GuiImage();
 		pGameDialog->Initialize(pResourceManager);
 		pGameDialog->SetVisible(false);
-		pGameDialog->SetTexture("Data\\Textures\\Dialog2.tga", true);
+		pGameDialog->SetTexture("Data\\Textures\\Dialog0.tga", true);
 		pGameDialog->SetPosition(0.5f * (ScreenSizeX - pGameDialog->GetWidth()), 0.5f * (ScreenSizeY - pGameDialog->GetHeight()));
 		//pGameDialog->Add(pGameDialogOk);
 
--- a/LightClone/ToDo.txt	Thu Sep 15 21:45:00 2011 -0700
+++ b/LightClone/ToDo.txt	Fri Sep 16 09:29:53 2011 -0700
@@ -4,10 +4,13 @@
 4.	Main menu
 5.	Pause menu
 6.	Robot model & texture
-7.	Separate button images from dialog box
-8.	Implement confirm exit dialog
-9.	Create textures for each button state
-10. Help interface
-11. Add button to clear code panes
-12. Get interface working again
-13. Finish conversion to world model
\ No newline at end of file
+7.	Implement confirm exit dialog
+8. Help interface
+9. Add button to clear code panes
+10. Implement drag and drop
+	a.	Implement mouse capturing
+	b.	Add drag and drop interface to GuiInterface and move handling into subclasses
+11. Add flags to gui elements (picking, visibility)
+12. Implement caching in the resource manager
+13. Implement gui batching
+14.	Add GuiInterface reference to GuiElement
\ No newline at end of file