changeset 64:3507bd831c7f

Hook up ServiceProvider
author koryspansel <koryspansel@bendbroadband.com>
date Tue, 04 Oct 2011 13:02:45 -0700
parents 44dcff5abf12
children 41980ff0607d
files LightClone/Source/ActionPanel.cpp LightClone/Source/ActionPanel.h LightClone/Source/ActionSlot.cpp LightClone/Source/ActionSlot.h LightClone/Source/Bot.cpp LightClone/Source/Bot.h LightClone/Source/Dialog.h LightClone/Source/Environment.cpp LightClone/Source/Environment.h LightClone/Source/GuiButton.cpp LightClone/Source/GuiCursor.cpp LightClone/Source/GuiElement.cpp LightClone/Source/GuiElement.h LightClone/Source/GuiImage.cpp LightClone/Source/GuiImage.h LightClone/Source/GuiInterface.cpp LightClone/Source/GuiInterface.h LightClone/Source/GuiLabel.cpp LightClone/Source/GuiLabel.h LightClone/Source/GuiRenderContext.cpp LightClone/Source/GuiRenderContext.h LightClone/Source/Mediator.cpp LightClone/Source/ServiceProvider.cpp LightClone/Source/ServiceProvider.h LightClone/Source/World.cpp LightClone/Source/World.h
diffstat 26 files changed, 246 insertions(+), 196 deletions(-) [+]
line wrap: on
line diff
--- a/LightClone/Source/ActionPanel.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/ActionPanel.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -20,14 +20,14 @@
 /*
  * Initialize
  */
-ErrorCode ActionPanel::Initialize(ResourceManager* pResourceManager)
+ErrorCode ActionPanel::Initialize(ServiceProvider* pServiceProvider)
 {
 	const float fSlotSizeX		= 48.0f;
 	const float fSlotSizeY		= 48.0f;
 	const float fSlotPadding	= 16.0f;
 	const float fSlotSpacing	= 8.0f;
 
-	ErrorCode eCode = GuiImage::Initialize(pResourceManager);
+	ErrorCode eCode = GuiImage::Initialize(pServiceProvider);
 	if(eCode == Error_Success)
 	{
 		SetDimensions(2.0f * fSlotPadding + (fSlotSizeX + fSlotSpacing) * nSizeX - fSlotSpacing, 2.0f * fSlotPadding + (fSlotSizeY + fSlotSpacing) * nSizeY - fSlotSpacing);
@@ -38,7 +38,7 @@
 			{
 				const uint32 nIndex = i * nSizeX + j;
 
-				pSlot[nIndex].Initialize(pResourceManager);
+				pSlot[nIndex].Initialize(pServiceProvider);
 				pSlot[nIndex].SetTexture("Data\\Textures\\Slot.tga");
 				pSlot[nIndex].SetDimensions(fSlotSizeX, fSlotSizeY);
 				pSlot[nIndex].SetPosition(fSlotPadding + (fSlotSizeX + fSlotSpacing) * j, fSlotPadding + (fSlotSizeY + fSlotSpacing) * i);
--- a/LightClone/Source/ActionPanel.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/ActionPanel.h	Tue Oct 04 13:02:45 2011 -0700
@@ -65,7 +65,7 @@
 	/*
 	 * Initialize
 	 */
-	virtual ErrorCode Initialize(ResourceManager* pResourceManager);
+	virtual ErrorCode Initialize(ServiceProvider* pServiceProvider);
 
 	/*
 	 * SetAvailableSlots
--- a/LightClone/Source/ActionSlot.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/ActionSlot.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -31,9 +31,9 @@
 /*
  * Initialize
  */
-ErrorCode ActionSlot::Initialize(ResourceManager* pManager)
+ErrorCode ActionSlot::Initialize(ServiceProvider* pServiceProvider)
 {
-	ErrorCode eCode = GuiImage::Initialize(pManager);
+	ErrorCode eCode = GuiImage::Initialize(pServiceProvider);
 	if(eCode == Error_Success)
 	{
 		SetTexture("Data\\Textures\\Slot.tga");
@@ -128,7 +128,7 @@
 
 			// create a new element to represent the object being dragged
 			ActionSlot* pInstance = new ActionSlot();
-			pInstance->Initialize(pResourceManager);
+			pInstance->Initialize(pServiceProvider);
 			pInstance->SetAction(nAction);
 			pInstance->SetDimensions(kDimensions);
 			pInstance->SetPosition(kPosition);
--- a/LightClone/Source/ActionSlot.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/ActionSlot.h	Tue Oct 04 13:02:45 2011 -0700
@@ -38,7 +38,7 @@
 	/*
 	 * Initialize
 	 */
-	virtual ErrorCode Initialize(ResourceManager* pResourceManager);
+	virtual ErrorCode Initialize(ServiceProvider* pServiceProvider);
 
 	/*
 	 * Terminate
--- a/LightClone/Source/Bot.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/Bot.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -29,18 +29,24 @@
 /*
  * Initialize
  */
-ErrorCode Bot::Initialize(ResourceManager* pResourceManager)
+ErrorCode Bot::Initialize(ServiceProvider* pServiceProvider)
 {
-	ErrorCode eCode = pResourceManager->CreateEffectFromFile("Data\\Shaders\\Environment.fx", &pEffect);
+	ResourceManager* pResourceManager = NULL;
+
+	ErrorCode eCode = pServiceProvider->GetService("ResourceManager", &pResourceManager);
 	if(eCode == Error_Success)
 	{
-		eCode = pResourceManager->CreateTextureFromFile("Data\\Textures\\Bot.tga", &pTexture);
+		eCode = pResourceManager->CreateEffectFromFile("Data\\Shaders\\Environment.fx", &pEffect);
 		if(eCode == Error_Success)
 		{
-			eCode = pResourceManager->CreateVertexBuffer(VerticesPerBlock * sizeof(Vertex::Block), D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED, &pVertexBuffer);
+			eCode = pResourceManager->CreateTextureFromFile("Data\\Textures\\Bot.tga", &pTexture);
 			if(eCode == Error_Success)
 			{
-				eCode = SetupVertexBuffer();
+				eCode = pResourceManager->CreateVertexBuffer(VerticesPerBlock * sizeof(Vertex::Block), D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED, &pVertexBuffer);
+				if(eCode == Error_Success)
+				{
+					eCode = SetupVertexBuffer();
+				}
 			}
 		}
 	}
@@ -392,36 +398,34 @@
 	const float fScaleU = 64.0f / 320.0f;
 	const float fScaleV = 128.0f / 128.0f;
 
-	//
-
-	// front
-	pVertices[0]	= Vertex::Block(-0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 0 * fScaleU + 0 * fScaleU, 1 * fScaleV);	// lower left
-	pVertices[1]	= Vertex::Block(-0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 0 * fScaleU + 0 * fScaleU, 0 * fScaleV);	// upper left
-	pVertices[2]	= Vertex::Block(+0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 0 * fScaleU + 1 * fScaleU, 0 * fScaleV);	// upper right
-	pVertices[3]	= Vertex::Block(-0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 0 * fScaleU + 0 * fScaleU, 1 * fScaleV);	// lower left
-	pVertices[4]	= Vertex::Block(+0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 0 * fScaleU + 1 * fScaleU, 0 * fScaleV);	// upper right
-	pVertices[5]	= Vertex::Block(+0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 0 * fScaleU + 1 * fScaleU, 1 * fScaleV);	// lower right
+	// right
+	pVertices[0]	= Vertex::Block(-0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 0 * fScaleU, 1 * fScaleV);
+	pVertices[1]	= Vertex::Block(-0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 0 * fScaleU, 0 * fScaleV);
+	pVertices[2]	= Vertex::Block(+0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 1 * fScaleU, 0 * fScaleV);
+	pVertices[3]	= Vertex::Block(-0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 0 * fScaleU, 1 * fScaleV);
+	pVertices[4]	= Vertex::Block(+0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 1 * fScaleU, 0 * fScaleV);
+	pVertices[5]	= Vertex::Block(+0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 3 * fScaleU + 1 * fScaleU, 1 * fScaleV);
+	// left
+	pVertices[6]	= Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 0 * fScaleU, 1 * fScaleV);
+	pVertices[7]	= Vertex::Block(+0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 0 * fScaleU, 0 * fScaleV);
+	pVertices[8]	= Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 1 * fScaleU, 0 * fScaleV);
+	pVertices[9]	= Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 0 * fScaleU, 1 * fScaleV);
+	pVertices[10]	= Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 1 * fScaleU, 0 * fScaleV);
+	pVertices[11]	= Vertex::Block(-0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 2 * fScaleU + 1 * fScaleU, 1 * fScaleV);
 	// back
-	pVertices[6]	= Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 1 * fScaleU + 0 * fScaleU, 1 * fScaleV);
-	pVertices[7]	= Vertex::Block(+0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 1 * fScaleU + 0 * fScaleU, 0 * fScaleV);
-	pVertices[8]	= Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 1 * fScaleU + 1 * fScaleU, 0 * fScaleV);
-	pVertices[9]	= Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 1 * fScaleU + 0 * fScaleU, 1 * fScaleV);
-	pVertices[10]	= Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 1 * fScaleU + 1 * fScaleU, 0 * fScaleV);
-	pVertices[11]	= Vertex::Block(-0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 1 * fScaleU + 1 * fScaleU, 1 * fScaleV);
-	// left
-	pVertices[12]	= Vertex::Block(-0.5f, 0.0f, +0.5f, -1.0f, 0.0f, 0.0f, 2 * fScaleU + 0 * fScaleU, 1 * fScaleV);
-	pVertices[13]	= Vertex::Block(-0.5f, 1.0f, +0.5f, -1.0f, 0.0f, 0.0f, 2 * fScaleU + 0 * fScaleU, 0 * fScaleV);
-	pVertices[14]	= Vertex::Block(-0.5f, 1.0f, -0.5f, -1.0f, 0.0f, 0.0f, 2 * fScaleU + 1 * fScaleU, 0 * fScaleV);
-	pVertices[15]	= Vertex::Block(-0.5f, 0.0f, +0.5f, -1.0f, 0.0f, 0.0f, 2 * fScaleU + 0 * fScaleU, 1 * fScaleV);
-	pVertices[16]	= Vertex::Block(-0.5f, 1.0f, -0.5f, -1.0f, 0.0f, 0.0f, 2 * fScaleU + 1 * fScaleU, 0 * fScaleV);
-	pVertices[17]	= Vertex::Block(-0.5f, 0.0f, -0.5f, -1.0f, 0.0f, 0.0f, 2 * fScaleU + 1 * fScaleU, 1 * fScaleV);
-	// right
-	pVertices[18]	= Vertex::Block(+0.5f, 0.0f, -0.5f, +1.0f, 0.0f, 0.0f, 3 * fScaleU + 0 * fScaleU, 1 * fScaleV);
-	pVertices[19]	= Vertex::Block(+0.5f, 1.0f, -0.5f, +1.0f, 0.0f, 0.0f, 3 * fScaleU + 0 * fScaleU, 0 * fScaleV);
-	pVertices[20]	= Vertex::Block(+0.5f, 1.0f, +0.5f, +1.0f, 0.0f, 0.0f, 3 * fScaleU + 1 * fScaleU, 0 * fScaleV);
-	pVertices[21]	= Vertex::Block(+0.5f, 0.0f, -0.5f, +1.0f, 0.0f, 0.0f, 3 * fScaleU + 0 * fScaleU, 1 * fScaleV);
-	pVertices[22]	= Vertex::Block(+0.5f, 1.0f, +0.5f, +1.0f, 0.0f, 0.0f, 3 * fScaleU + 1 * fScaleU, 0 * fScaleV);
-	pVertices[23]	= Vertex::Block(+0.5f, 0.0f, +0.5f, +1.0f, 0.0f, 0.0f, 3 * fScaleU + 1 * fScaleU, 1 * fScaleV);
+	pVertices[12]	= Vertex::Block(-0.5f, 0.0f, +0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 0 * fScaleU, 1 * fScaleV);
+	pVertices[13]	= Vertex::Block(-0.5f, 1.0f, +0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 0 * fScaleU, 0 * fScaleV);
+	pVertices[14]	= Vertex::Block(-0.5f, 1.0f, -0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 1 * fScaleU, 0 * fScaleV);
+	pVertices[15]	= Vertex::Block(-0.5f, 0.0f, +0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 0 * fScaleU, 1 * fScaleV);
+	pVertices[16]	= Vertex::Block(-0.5f, 1.0f, -0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 1 * fScaleU, 0 * fScaleV);
+	pVertices[17]	= Vertex::Block(-0.5f, 0.0f, -0.5f, -1.0f, 0.0f, 0.0f, 1 * fScaleU + 1 * fScaleU, 1 * fScaleV);
+	// front
+	pVertices[18]	= Vertex::Block(+0.5f, 0.0f, -0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 0 * fScaleU, 1 * fScaleV);
+	pVertices[19]	= Vertex::Block(+0.5f, 1.0f, -0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 0 * fScaleU, 0 * fScaleV);
+	pVertices[20]	= Vertex::Block(+0.5f, 1.0f, +0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 1 * fScaleU, 0 * fScaleV);
+	pVertices[21]	= Vertex::Block(+0.5f, 0.0f, -0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 0 * fScaleU, 1 * fScaleV);
+	pVertices[22]	= Vertex::Block(+0.5f, 1.0f, +0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 1 * fScaleU, 0 * fScaleV);
+	pVertices[23]	= Vertex::Block(+0.5f, 0.0f, +0.5f, +1.0f, 0.0f, 0.0f, 0 * fScaleU + 1 * fScaleU, 1 * fScaleV);
 	// top
 	pVertices[24]	= Vertex::Block(-0.5f, 1.0f, -0.5f, 0.0f, +1.0f, 0.0f, 4 * fScaleU + 0 * fScaleU, 0.0f * fScaleV + 0.5f * fScaleV);
 	pVertices[25]	= Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, +1.0f, 0.0f, 4 * fScaleU + 0 * fScaleU, 0.0f * fScaleV + 0.0f * fScaleV);
@@ -437,51 +441,6 @@
 	pVertices[34]	= Vertex::Block(+0.5f, 0.0f, -0.5f, 0.0f, -1.0f, 0.0f, 5 * fScaleU + 1 * fScaleU, 0.5f * fScaleV + 0.0f * fScaleV);
 	pVertices[35]	= Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, -1.0f, 0.0f, 5 * fScaleU + 1 * fScaleU, 0.5f * fScaleV + 0.5f * fScaleV);
 
-	/*
-	// front
-	pVertices[0]	= Vertex::Block(-0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 0.00f, 1.00f);	// lower left
-	pVertices[1]	= Vertex::Block(-0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 0.00f, 0.66f);	// upper left
-	pVertices[2]	= Vertex::Block(+0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 1.00f, 0.66f);	// upper right
-	pVertices[3]	= Vertex::Block(-0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 0.00f, 1.00f);	// lower left
-	pVertices[4]	= Vertex::Block(+0.5f, 1.0f, -0.5f, 0.0f, 0.0f, -1.0f, 1.00f, 0.66f);	// upper right
-	pVertices[5]	= Vertex::Block(+0.5f, 0.0f, -0.5f, 0.0f, 0.0f, -1.0f, 1.00f, 1.00f);	// lower right
-	// back
-	pVertices[6]	= Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 0.00f, 1.00f);
-	pVertices[7]	= Vertex::Block(+0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 0.00f, 0.66f);
-	pVertices[8]	= Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 1.00f, 0.66f);
-	pVertices[9]	= Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 0.00f, 1.00f);
-	pVertices[10]	= Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, 0.0f, +1.0f, 1.00f, 0.66f);
-	pVertices[11]	= Vertex::Block(-0.5f, 0.0f, +0.5f, 0.0f, 0.0f, +1.0f, 1.00f, 1.00f);
-	// left
-	pVertices[12]	= Vertex::Block(-0.5f, 0.0f, +0.5f, -1.0f, 0.0f, 0.0f, 0.00f, 1.00f);
-	pVertices[13]	= Vertex::Block(-0.5f, 1.0f, +0.5f, -1.0f, 0.0f, 0.0f, 0.00f, 0.66f);
-	pVertices[14]	= Vertex::Block(-0.5f, 1.0f, -0.5f, -1.0f, 0.0f, 0.0f, 1.00f, 0.66f);
-	pVertices[15]	= Vertex::Block(-0.5f, 0.0f, +0.5f, -1.0f, 0.0f, 0.0f, 0.00f, 1.00f);
-	pVertices[16]	= Vertex::Block(-0.5f, 1.0f, -0.5f, -1.0f, 0.0f, 0.0f, 1.00f, 0.66f);
-	pVertices[17]	= Vertex::Block(-0.5f, 0.0f, -0.5f, -1.0f, 0.0f, 0.0f, 1.00f, 1.00f);
-	// right
-	pVertices[18]	= Vertex::Block(+0.5f, 0.0f, -0.5f, +1.0f, 0.0f, 0.0f, 0.00f, 1.00f);
-	pVertices[19]	= Vertex::Block(+0.5f, 1.0f, -0.5f, +1.0f, 0.0f, 0.0f, 0.00f, 0.66f);
-	pVertices[20]	= Vertex::Block(+0.5f, 1.0f, +0.5f, +1.0f, 0.0f, 0.0f, 1.00f, 0.66f);
-	pVertices[21]	= Vertex::Block(+0.5f, 0.0f, -0.5f, +1.0f, 0.0f, 0.0f, 0.00f, 1.00f);
-	pVertices[22]	= Vertex::Block(+0.5f, 1.0f, +0.5f, +1.0f, 0.0f, 0.0f, 1.00f, 0.66f);
-	pVertices[23]	= Vertex::Block(+0.5f, 0.0f, +0.5f, +1.0f, 0.0f, 0.0f, 1.00f, 1.00f);
-	// top
-	pVertices[24]	= Vertex::Block(-0.5f, 1.0f, -0.5f, 0.0f, +1.0f, 0.0f, 0.00f, 0.66f);
-	pVertices[25]	= Vertex::Block(-0.5f, 1.0f, +0.5f, 0.0f, +1.0f, 0.0f, 0.00f, 0.00f);
-	pVertices[26]	= Vertex::Block(+0.5f, 1.0f, +0.5f, 0.0f, +1.0f, 0.0f, 1.00f, 0.00f);
-	pVertices[27]	= Vertex::Block(-0.5f, 1.0f, -0.5f, 0.0f, +1.0f, 0.0f, 0.00f, 0.66f);
-	pVertices[28]	= Vertex::Block(+0.5f, 1.0f, +0.5f, 0.0f, +1.0f, 0.0f, 1.00f, 0.00f);
-	pVertices[29]	= Vertex::Block(+0.5f, 1.0f, -0.5f, 0.0f, +1.0f, 0.0f, 1.00f, 0.66f);
-	// bottom
-	pVertices[30]	= Vertex::Block(-0.5f, 0.0f, +0.5f, 0.0f, -1.0f, 0.0f, 0.00f, 0.66f);
-	pVertices[31]	= Vertex::Block(-0.5f, 0.0f, -0.5f, 0.0f, -1.0f, 0.0f, 0.00f, 0.00f);
-	pVertices[32]	= Vertex::Block(+0.5f, 0.0f, -0.5f, 0.0f, -1.0f, 0.0f, 1.00f, 0.00f);
-	pVertices[33]	= Vertex::Block(-0.5f, 0.0f, +0.5f, 0.0f, -1.0f, 0.0f, 0.00f, 0.66f);
-	pVertices[34]	= Vertex::Block(+0.5f, 0.0f, -0.5f, 0.0f, -1.0f, 0.0f, 1.00f, 0.00f);
-	pVertices[35]	= Vertex::Block(+0.5f, 0.0f, +0.5f, 0.0f, -1.0f, 0.0f, 1.00f, 0.66f);
-	*/
-
 	pVertexBuffer->Unlock();
 
 	return Error_Success;
--- a/LightClone/Source/Bot.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/Bot.h	Tue Oct 04 13:02:45 2011 -0700
@@ -12,6 +12,7 @@
 #include "Environment.h"
 #include "Clock.h"
 #include "Program.h"
+#include "ServiceProvider.h"
 
 /*
  * BotState
@@ -150,7 +151,7 @@
 	/*
 	 * Reset
 	 */
-	ErrorCode Initialize(ResourceManager* pResourceManager);
+	ErrorCode Initialize(ServiceProvider* pServiceProvider);
 
 	/*
 	 * Terminate
--- a/LightClone/Source/Dialog.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/Dialog.h	Tue Oct 04 13:02:45 2011 -0700
@@ -56,14 +56,14 @@
 	/*
 	 * Initialize
 	 */
-	virtual ErrorCode Initialize(ResourceManager* pResourceManager)
+	virtual ErrorCode Initialize(ServiceProvider* pServiceProvider)
 	{
-		ErrorCode eCode = GuiDialog::Initialize(pResourceManager);
+		ErrorCode eCode = GuiDialog::Initialize(pServiceProvider);
 		if(eCode == Error_Success)
 		{
 			SetTexture("Data\\Textures\\Dialog0.tga", true);
 
-			kLabel.Initialize(pResourceManager);
+			kLabel.Initialize(pServiceProvider);
 			kLabel.SetPosition(0.5f * kDimensions.x, 0.15f * kDimensions.y);
 			kLabel.SetLabelFlag(GuiLabelFlag_CenterX);
 			kLabel.SetFont("Courier New", 16);
@@ -73,7 +73,7 @@
 
 			for(uint32 i = 0; i < ButtonCount; ++i)
 			{
-				kButton[i].Initialize(pResourceManager);
+				kButton[i].Initialize(pServiceProvider);
 				kButton[i].SetTexture(GuiButtonState_Normal, "Data\\Textures\\ButtonN.tga", true);
 				kButton[i].SetTexture(GuiButtonState_Hover, "Data\\Textures\\ButtonH.tga");
 				kButton[i].SetTexture(GuiButtonState_Down, "Data\\Textures\\ButtonD.tga");
--- a/LightClone/Source/Environment.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/Environment.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -3,6 +3,7 @@
  */
 
 #include "Environment.h"
+#include "ResourceManager.h"
 #include "VertexTypes.h"
 #include "Util.h"
 
@@ -32,29 +33,35 @@
 /*
  * Initialize
  */
-ErrorCode Environment::Initialize(ResourceManager* pResourceManager)
+ErrorCode Environment::Initialize(ServiceProvider* pServiceProvider)
 {
-	ErrorCode eCode = pResourceManager->CreateEffectFromFile("Data\\Shaders\\Environment.fx", &pEffect);
+	ResourceManager* pResourceManager = NULL;
+
+	ErrorCode eCode = pServiceProvider->GetService("ResourceManager", &pResourceManager);
 	if(eCode == Error_Success)
 	{
-		eCode = pResourceManager->CreateTextureFromFile("Data\\Textures\\Block04.tga", &pTexture);
+		eCode = pResourceManager->CreateEffectFromFile("Data\\Shaders\\Environment.fx", &pEffect);
 		if(eCode == Error_Success)
 		{
-			eCode = pResourceManager->CreateVertexBuffer(VerticesPerBlock * sizeof(Vertex::Block), D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED, &pVertexBuffer);
+			eCode = pResourceManager->CreateTextureFromFile("Data\\Textures\\Block04.tga", &pTexture);
 			if(eCode == Error_Success)
 			{
-				eCode = SetupVertexBuffer();
+				eCode = pResourceManager->CreateVertexBuffer(VerticesPerBlock * sizeof(Vertex::Block), D3DUSAGE_WRITEONLY, D3DPOOL_MANAGED, &pVertexBuffer);
+				if(eCode == Error_Success)
+				{
+					eCode = SetupVertexBuffer();
+				}
+			}
+			else
+			{
+				TRACE("Error: Failed to load Data\\Textures\\Block04.tga\n");
 			}
 		}
 		else
 		{
-			TRACE("Error: Failed to load Data\\Textures\\Block04.tga\n");
+			TRACE("Error: Failed to load Data\\Shaders\\Environment.fx\n");
 		}
 	}
-	else
-	{
-		TRACE("Error: Failed to load Data\\Shaders\\Environment.fx\n");
-	}
 
 	return eCode;
 }
@@ -161,7 +168,7 @@
 	pEffect->EndPass();
 	pEffect->End();
 
-	if(true) // wireframe
+	if(false) // wireframe
 	{
 		pEffect->SetTechnique(pEffect->GetTechniqueByName("Wire"));
 		pEffect->Begin(&nPasses, 0);
--- a/LightClone/Source/Environment.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/Environment.h	Tue Oct 04 13:02:45 2011 -0700
@@ -7,7 +7,7 @@
 
 #include "Core.h"
 #include "RenderContext.h"
-#include "ResourceManager.h"
+#include "ServiceProvider.h"
 
 /*
  * Tower
@@ -99,7 +99,7 @@
 	/*
 	 * Initialize
 	 */
-	ErrorCode Initialize(ResourceManager* pResourceManager);
+	ErrorCode Initialize(ServiceProvider* pServiceProvider);
 
 	/*
 	 * Terminate
--- a/LightClone/Source/GuiButton.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiButton.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -72,22 +72,26 @@
  */
 ErrorCode GuiButton::SetTexture(uint32 nState, const char* pName, bool bResize)
 {
-	ErrorCode eCode = Error_Fail;
+	ResourceManager* pResourceManager = NULL;
 
-	if(nState < GuiButtonState_Count)
+	ErrorCode eCode = pServiceProvider->GetService("ResourceManager", &pResourceManager);
+	if(eCode == Error_Success)
 	{
-		pTexture[nState] = NULL;
+		if(nState < GuiButtonState_Count)
+		{
+			pTexture[nState] = NULL;
 
-		eCode = pResourceManager->CreateTextureFromFile(pName, &pTexture[nState]);
-		if(eCode == Error_Success)
-		{
-			if(bResize)
+			eCode = pResourceManager->CreateTextureFromFile(pName, &pTexture[nState]);
+			if(eCode == Error_Success)
 			{
-				D3DSURFACE_DESC kDescriptor;
-				pTexture[nState]->GetLevelDesc(0, &kDescriptor);
+				if(bResize)
+				{
+					D3DSURFACE_DESC kDescriptor;
+					pTexture[nState]->GetLevelDesc(0, &kDescriptor);
 
-				kDimensions.x = (float)kDescriptor.Width;
-				kDimensions.y = (float)kDescriptor.Height;
+					kDimensions.x = (float)kDescriptor.Width;
+					kDimensions.y = (float)kDescriptor.Height;
+				}
 			}
 		}
 	}
@@ -102,7 +106,15 @@
 {
 	pFont = NULL;
 
-	return pResourceManager->CreateFontFromName(pName, nSize, nWeight, &pFont);
+	ResourceManager* pResourceManager = NULL;
+
+	ErrorCode eCode = pServiceProvider->GetService("ResourceManager", &pResourceManager);
+	if(eCode == Error_Success)
+	{
+		eCode = pResourceManager->CreateFontFromName(pName, nSize, nWeight, &pFont);
+	}
+
+	return eCode;
 }
 
 /*
--- a/LightClone/Source/GuiCursor.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiCursor.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -65,16 +65,22 @@
 {
 	pTexture = NULL;
 
-	ErrorCode eCode = pResourceManager->CreateTextureFromFile(pName, &pTexture);
+	ResourceManager* pResourceManager = NULL;
+
+	ErrorCode eCode = pServiceProvider->GetService("ResourceManager", &pResourceManager);
 	if(eCode == Error_Success)
 	{
-		if(bResize)
+		eCode = pResourceManager->CreateTextureFromFile(pName, &pTexture);
+		if(eCode == Error_Success)
 		{
-			D3DSURFACE_DESC kDescriptor;
-			pTexture->GetLevelDesc(0, &kDescriptor);
+			if(bResize)
+			{
+				D3DSURFACE_DESC kDescriptor;
+				pTexture->GetLevelDesc(0, &kDescriptor);
 
-			kDimensions.x = (float)kDescriptor.Width;
-			kDimensions.y = (float)kDescriptor.Height;
+				kDimensions.x = (float)kDescriptor.Width;
+				kDimensions.y = (float)kDescriptor.Height;
+			}
 		}
 	}
 
--- a/LightClone/Source/GuiElement.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiElement.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -32,10 +32,10 @@
 /*
  * Initialize
  */
-ErrorCode GuiElement::Initialize(ResourceManager* pManager)
+ErrorCode GuiElement::Initialize(ServiceProvider* pInstance)
 {
-	ASSERT(pManager != NULL);
-	pResourceManager = pManager;
+	ASSERT(pInstance != NULL);
+	pServiceProvider = pInstance;
 
 	return Error_Success;
 }
--- a/LightClone/Source/GuiElement.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiElement.h	Tue Oct 04 13:02:45 2011 -0700
@@ -12,6 +12,7 @@
 #include "ArrayList.h"
 #include "GuiEventMap.h"
 #include "GuiRenderContext.h"
+#include "ServiceProvider.h"
 
 /*
  * GuiElementFlag
@@ -47,9 +48,9 @@
 protected:
 
 	/*
-	 * pResourceManager
+	 * pServiceProvider
 	 */
-	ResourceManager* pResourceManager;
+	ServiceProvider* pServiceProvider;
 
 	/*
 	 * pInterface
@@ -106,7 +107,7 @@
 	/*
 	 * Initialize
 	 */
-	virtual ErrorCode Initialize(ResourceManager* pResourceManager);
+	virtual ErrorCode Initialize(ServiceProvider* pServiceProvider);
 
 	/*
 	 * Terminate
--- a/LightClone/Source/GuiImage.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiImage.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -15,9 +15,9 @@
 /*
  * Initialize
  */
-ErrorCode GuiImage::Initialize(ResourceManager* pResourceManager)
+ErrorCode GuiImage::Initialize(ServiceProvider* pServiceProvider)
 {
-	return GuiElement::Initialize(pResourceManager);
+	return GuiElement::Initialize(pServiceProvider);
 }
 
 /*
@@ -43,16 +43,22 @@
 {
 	pTexture = NULL;
 
-	ErrorCode eCode = pResourceManager->CreateTextureFromFile(pName, &pTexture);
+	ResourceManager* pResourceManager = NULL;
+
+	ErrorCode eCode = pServiceProvider->GetService("ResourceManager", &pResourceManager);
 	if(eCode == Error_Success)
 	{
-		if(bResize)
+		eCode = pResourceManager->CreateTextureFromFile(pName, &pTexture);
+		if(eCode == Error_Success)
 		{
-			D3DSURFACE_DESC kDescriptor;
-			pTexture->GetLevelDesc(0, &kDescriptor);
+			if(bResize)
+			{
+				D3DSURFACE_DESC kDescriptor;
+				pTexture->GetLevelDesc(0, &kDescriptor);
 
-			kDimensions.x = (float)kDescriptor.Width;
-			kDimensions.y = (float)kDescriptor.Height;
+				kDimensions.x = (float)kDescriptor.Width;
+				kDimensions.y = (float)kDescriptor.Height;
+			}
 		}
 	}
 
--- a/LightClone/Source/GuiImage.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiImage.h	Tue Oct 04 13:02:45 2011 -0700
@@ -30,7 +30,7 @@
 	/*
 	 * Initialize
 	 */
-	virtual ErrorCode Initialize(ResourceManager* pResourceManager);
+	virtual ErrorCode Initialize(ServiceProvider* pServiceProvider);
 
 	/*
 	 * Render
--- a/LightClone/Source/GuiInterface.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiInterface.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -16,25 +16,31 @@
 /*
  * Initialize
  */
-ErrorCode GuiInterface::Initialize(ResourceManager* pResourceManager, InputManager* pInput)
+ErrorCode GuiInterface::Initialize(ServiceProvider* pServiceProvider)
 {
-	ErrorCode eCode = kRenderContext.Initialize(pResourceManager);
+	ResourceManager* pResourceManager = NULL;
+
+	ErrorCode eCode = pServiceProvider->GetService("ResourceManager", &pResourceManager);
 	if(eCode == Error_Success)
 	{
-		eCode = GuiElement::Initialize(pResourceManager);
+		eCode = kRenderContext.Initialize(pServiceProvider);
 		if(eCode == Error_Success)
 		{
-			eCode = pCursor->Initialize(pResourceManager);
+			eCode = GuiElement::Initialize(pServiceProvider);
 			if(eCode == Error_Success)
 			{
-				eCode = pCursor->SetTexture("Data\\Textures\\Arrow.tga");
+				eCode = pCursor->Initialize(pServiceProvider);
 				if(eCode == Error_Success)
 				{
-					pInputManager = pInput;
-					ASSERT(pInputManager);
+					eCode = pCursor->SetTexture("Data\\Textures\\Arrow.tga");
+					if(eCode == Error_Success)
+					{
+						pInputManager = (InputManager*)pServiceProvider->GetService("InputManager");
+						ASSERT(pInputManager != NULL);
 
-					pInputManager->SetBounds(0.0f, 0.0f, (float)ScreenSizeX, (float)ScreenSizeY);
-					pInputManager->SetMouse(0.5f * ScreenSizeX, 0.5f * ScreenSizeY);
+						pInputManager->SetBounds(0.0f, 0.0f, (float)ScreenSizeX, (float)ScreenSizeY);
+						pInputManager->SetMouse(0.5f * ScreenSizeX, 0.5f * ScreenSizeY);
+					}
 				}
 			}
 		}
--- a/LightClone/Source/GuiInterface.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiInterface.h	Tue Oct 04 13:02:45 2011 -0700
@@ -10,6 +10,7 @@
 #include "GuiCursor.h"
 #include "GuiRenderContext.h"
 #include "InputManager.h"
+#include "ServiceProvider.h"
 
 /*
  * GuiInterface
@@ -61,7 +62,7 @@
 	/*
 	 * Initialize
 	 */
-	ErrorCode Initialize(ResourceManager* pResourceManager, InputManager* pInputManager);
+	ErrorCode Initialize(ServiceProvider* pServiceProvider);
 
 	/*
 	 * Terminate
--- a/LightClone/Source/GuiLabel.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiLabel.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -14,9 +14,9 @@
 /*
  * Initialize
  */
-ErrorCode GuiLabel::Initialize(ResourceManager* pResourceManager)
+ErrorCode GuiLabel::Initialize(ServiceProvider* pServiceProvider)
 {
-	return GuiElement::Initialize(pResourceManager);
+	return GuiElement::Initialize(pServiceProvider);
 }
 
 /*
@@ -66,7 +66,15 @@
 {
 	pFont = NULL;
 
-	return pResourceManager->CreateFontFromName(pName, nSize, nWeight, &pFont);
+	ResourceManager* pResourceManager = NULL;
+	
+	ErrorCode eCode = pServiceProvider->GetService("ResourceManager", &pResourceManager);
+	if(eCode == Error_Success)
+	{
+		eCode = pResourceManager->CreateFontFromName(pName, nSize, nWeight, &pFont);
+	}
+
+	return eCode;
 }
 
 /*
--- a/LightClone/Source/GuiLabel.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiLabel.h	Tue Oct 04 13:02:45 2011 -0700
@@ -48,7 +48,7 @@
 	/*
 	 * Initialize
 	 */
-	virtual ErrorCode Initialize(ResourceManager* pResourceManager);
+	virtual ErrorCode Initialize(ServiceProvider* pServiceProvider);
 
 	/*
 	 * Render
--- a/LightClone/Source/GuiRenderContext.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiRenderContext.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -3,6 +3,7 @@
  */
 
 #include "GuiRenderContext.h"
+#include "ResourceManager.h"
 
 /*
  * GuiRenderContext
@@ -14,12 +15,18 @@
 /*
  * Initialize
  */
-ErrorCode GuiRenderContext::Initialize(ResourceManager* pResourceManager)
+ErrorCode GuiRenderContext::Initialize(ServiceProvider* pServiceProvider)
 {
-	ErrorCode eCode = pResourceManager->CreateEffectFromFile("Data\\Shaders\\TexturedQuad.fx", &pEffect);
+	ResourceManager* pResourceManager = NULL;
+
+	ErrorCode eCode = pServiceProvider->GetService("ResourceManager", &pResourceManager);
 	if(eCode == Error_Success)
 	{
-		eCode = pResourceManager->CreateVertexBuffer(VertexBufferSize, D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, D3DPOOL_DEFAULT, &pVertexBuffer);
+		eCode = pResourceManager->CreateEffectFromFile("Data\\Shaders\\TexturedQuad.fx", &pEffect);
+		if(eCode == Error_Success)
+		{
+			eCode = pResourceManager->CreateVertexBuffer(VertexBufferSize, D3DUSAGE_WRITEONLY | D3DUSAGE_DYNAMIC, D3DPOOL_DEFAULT, &pVertexBuffer);
+		}
 	}
 
 	return eCode;
--- a/LightClone/Source/GuiRenderContext.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/GuiRenderContext.h	Tue Oct 04 13:02:45 2011 -0700
@@ -7,9 +7,9 @@
 
 #include "Core.h"
 #include "RenderContext.h"
+#include "ServiceProvider.h"
+#include "VertexTypes.h"
 #include "Camera.h"
-#include "ResourceManager.h"
-#include "VertexTypes.h"
 
 /*
  * GuiRenderContext
@@ -76,7 +76,7 @@
 	/*
 	 * Initialize
 	 */
-	ErrorCode Initialize(ResourceManager* pResourceManager);
+	ErrorCode Initialize(ServiceProvider* pServiceProvider);
 
 	/*
 	 * Terminate
--- a/LightClone/Source/Mediator.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/Mediator.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -128,15 +128,6 @@
 		return eCode;
 	}
 
-	eCode = kWorld.Initialize(&kResourceManager, &kInputManager);
-	if(eCode != Error_Success)
-	{
-		TRACE("Error: Failed to initialize world\n");
-
-		Terminate();
-		return eCode;
-	}
-
 	eCode = kServiceProvider.AddService("ResourceManager", &kResourceManager);
 	if(eCode != Error_Success)
 	{
@@ -154,7 +145,16 @@
 		Terminate();
 		return eCode;
 	}	
-	
+
+	eCode = kWorld.Initialize(&kServiceProvider);
+	if(eCode != Error_Success)
+	{
+		TRACE("Error: Failed to initialize world\n");
+
+		Terminate();
+		return eCode;
+	}
+
 	return eCode;
 }
 
--- a/LightClone/Source/ServiceProvider.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/ServiceProvider.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -3,12 +3,29 @@
  */
 
 #include "ServiceProvider.h"
+#include "ResourceManager.h"
+#include "InputManager.h"
+#include <string.h>
+
+static Service* pResourceManager = NULL;
+static Service* pInputManager = NULL;
 
 /*
  * AddService
  */
 ErrorCode ServiceProvider::AddService(const char* pName, Service* pService)
 {
+	if(strcmp(pName, "ResourceManager") == 0)
+	{
+		pResourceManager = pService;
+	}
+	else
+
+	if(strcmp(pName, "InputManager") == 0)
+	{
+		pInputManager = pService;
+	}
+
 	return Error_Success;
 }
 
@@ -17,5 +34,16 @@
  */
 Service* ServiceProvider::GetService(const char* pName)
 {
+	if(strcmp(pName, "ResourceManager") == 0)
+	{
+		return pResourceManager;
+	}
+	else
+
+	if(strcmp(pName, "InputManager") == 0)
+	{
+		return pInputManager;
+	}
+
 	return 0;
 }
--- a/LightClone/Source/ServiceProvider.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/ServiceProvider.h	Tue Oct 04 13:02:45 2011 -0700
@@ -29,7 +29,7 @@
 	 * GetService
 	 */
 	template<typename ServiceType>
-	ErrorCode GetService(const char* pName, Service** pService)
+	ErrorCode GetService(const char* pName, ServiceType** pService)
 	{
 		ErrorCode eCode = Error_Fail;
 
--- a/LightClone/Source/World.cpp	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/World.cpp	Tue Oct 04 13:02:45 2011 -0700
@@ -22,12 +22,9 @@
 /*
  * Initialize
  */
-ErrorCode World::Initialize(ResourceManager* pResourceManager, InputManager* pInput)
+ErrorCode World::Initialize(ServiceProvider* pServiceProvider)
 {
-	ASSERT(pResourceManager != NULL);
-	ASSERT(pInput != NULL);
-
-	ErrorCode eCode = kEnvironment.Initialize(pResourceManager);
+	ErrorCode eCode = kEnvironment.Initialize(pServiceProvider);
 	if(eCode != Error_Success)
 	{
 		TRACE("Error: Failed to initialize environment\n");
@@ -36,7 +33,7 @@
 		return eCode;
 	}
 
-	eCode = kBot.Initialize(pResourceManager);
+	eCode = kBot.Initialize(pServiceProvider);
 	if(eCode != Error_Success)
 	{
 		TRACE("Error: Failed to initialize bot\n");
@@ -54,7 +51,7 @@
 		return eCode;
 	}
 
-	eCode = InitializeInterface(pResourceManager, pInput);				
+	eCode = InitializeInterface(pServiceProvider);				
 	if(eCode != Error_Success)
 	{
 		TRACE("Error: Failed to initialize interface\n");
@@ -63,7 +60,15 @@
 		return eCode;
 	}
 
-	pInputManager		= pInput;
+	eCode = pServiceProvider->GetService("InputManager", &pInputManager);
+	if(eCode != Error_Success)
+	{
+		TRACE("Error: Failed to acquire input manager\n");
+
+		Terminate();
+		return eCode;
+	}
+
 	nWorldState			= WorldState_Game;
 	nLogicState			= LogicState_LevelLoad;
 	nSimulationState	= SimulationState_Idle;
@@ -219,19 +224,22 @@
 /*
  * InitializeInterface
  */
-ErrorCode World::InitializeInterface(ResourceManager* pResourceManager, InputManager* pInputManager)
+ErrorCode World::InitializeInterface(ServiceProvider* pServiceProvider)
 {
-	ErrorCode eCode = kInterface.Initialize(pResourceManager, pInputManager);
+	//ResourceManager* pResourceManager = (ResourceManager*)pServiceProvider->GetService("ResourceManager");
+	//ASSERT(pResourceManager != NULL);
+
+	ErrorCode eCode = kInterface.Initialize(pServiceProvider);
 	if(eCode == Error_Success)
 	{
 		pBackground = new GuiImage();
-		pBackground->Initialize(pResourceManager);
+		pBackground->Initialize(pServiceProvider);
 		pBackground->SetTexture("Data\\Textures\\Background04.tga", true);
 		pBackground->SetPosition(ScreenSizeX - pBackground->GetWidth(), 0.0f);
 		pBackground->SetDepth(512.0f);
 
 		pToolbar = new ActionPanel(4, 2);
-		pToolbar->Initialize(pResourceManager);
+		pToolbar->Initialize(pServiceProvider);
 		pToolbar->SetTexture("Data\\Textures\\PanelA.png");
 		pToolbar->SetPosition(16, 16.0f);
 		pToolbar->SetAction(0, Action_Forward);
@@ -245,7 +253,7 @@
 		pToolbar->SetDepth(256.0f);
 
 		GuiLabel* pMainLabel = new GuiLabel();
-		pMainLabel->Initialize(pResourceManager);
+		pMainLabel->Initialize(pServiceProvider);
 		pMainLabel->SetFont("Courier New", 16);
 		pMainLabel->SetText("Main:");
 		pMainLabel->SetColor(D3DCOLOR_XRGB(0, 0, 0));
@@ -253,34 +261,34 @@
 		pMainLabel->SetDepth(256.0f);
 
 		pCode[0] = new ActionPanel(4, 3);
-		pCode[0]->Initialize(pResourceManager);
+		pCode[0]->Initialize(pServiceProvider);
 		pCode[0]->SetTexture("Data\\Textures\\PanelB.png");
 		pCode[0]->SetPosition(16.0f, 160.0f);
 		pCode[0]->Subscribe(ActionPanel::EventAction, &World::OnAction, this);
 		pCode[0]->SetDepth(256.0f);
 
 		GuiLabel* pFunctionALabel = new GuiLabel();
-		pFunctionALabel->Initialize(pResourceManager);
+		pFunctionALabel->Initialize(pServiceProvider);
 		pFunctionALabel->SetFont("Courier New", 16);
 		pFunctionALabel->SetText("Function 1:");
 		pFunctionALabel->SetColor(D3DCOLOR_XRGB(0, 0, 0));
 		pFunctionALabel->SetPosition(26.0f, 349.0f);
 
 		pCode[1] = new ActionPanel(4, 2);
-		pCode[1]->Initialize(pResourceManager);
+		pCode[1]->Initialize(pServiceProvider);
 		pCode[1]->SetTexture("Data\\Textures\\PanelA.png");
 		pCode[1]->SetPosition(16.0f, 360.0f);
 		pCode[1]->Subscribe(ActionPanel::EventAction, &World::OnAction, this);
 
 		GuiLabel* pFunctionBLabel = new GuiLabel();
-		pFunctionBLabel->Initialize(pResourceManager);
+		pFunctionBLabel->Initialize(pServiceProvider);
 		pFunctionBLabel->SetFont("Courier New", 16);
 		pFunctionBLabel->SetText("Function 2:");
 		pFunctionBLabel->SetColor(D3DCOLOR_XRGB(0, 0, 0));
 		pFunctionBLabel->SetPosition(26.0f, 493.0f);
 
 		pCode[2] = new ActionPanel(4, 2);
-		pCode[2]->Initialize(pResourceManager);
+		pCode[2]->Initialize(pServiceProvider);
 		pCode[2]->SetTexture("Data\\Textures\\PanelA.png");
 		pCode[2]->SetPosition(16.0f, 504.0f);
 		pCode[2]->Subscribe(ActionPanel::EventAction, &World::OnAction, this);
@@ -290,7 +298,7 @@
 		const float fButtonSize		= 48.0f;
 
 		pButtonPlay = new GuiButton();
-		pButtonPlay->Initialize(pResourceManager);
+		pButtonPlay->Initialize(pServiceProvider);
 		pButtonPlay->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Button2N.png", true);
 		pButtonPlay->SetTexture(GuiButtonState_Hover, "Data\\Textures\\Button2H.png", true);
 		pButtonPlay->SetTexture(GuiButtonState_Down, "Data\\Textures\\Button2D.png", true);
@@ -301,7 +309,7 @@
 		pButtonPlay->Subscribe(GuiButton::EventClick, &World::OnPlay, this);
 
 		pButtonStop = new GuiButton();
-		pButtonStop->Initialize(pResourceManager);
+		pButtonStop->Initialize(pServiceProvider);
 		pButtonStop->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Button2N.png", true);
 		pButtonStop->SetTexture(GuiButtonState_Hover, "Data\\Textures\\Button2H.png", true);
 		pButtonStop->SetTexture(GuiButtonState_Down, "Data\\Textures\\Button2D.png", true);
@@ -312,7 +320,7 @@
 		pButtonStop->Subscribe(GuiButton::EventClick, &World::OnStop, this);
 
 		pButtonReset = new GuiButton();
-		pButtonReset->Initialize(pResourceManager);
+		pButtonReset->Initialize(pServiceProvider);
 		pButtonReset->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Button2N.png", true);
 		pButtonReset->SetTexture(GuiButtonState_Hover, "Data\\Textures\\Button2H.png", true);
 		pButtonReset->SetTexture(GuiButtonState_Down, "Data\\Textures\\Button2D.png", true);
@@ -323,7 +331,7 @@
 		pButtonReset->Subscribe(GuiButton::EventClick, &World::OnReset, this);
 
 		pButtonExit = new GuiButton();
-		pButtonExit->Initialize(pResourceManager);
+		pButtonExit->Initialize(pServiceProvider);
 		pButtonExit->SetTexture(GuiButtonState_Normal, "Data\\Textures\\Button2N.png", true);
 		pButtonExit->SetTexture(GuiButtonState_Hover, "Data\\Textures\\Button2H.png", true);
 		pButtonExit->SetTexture(GuiButtonState_Down, "Data\\Textures\\Button2D.png", true);
@@ -346,21 +354,21 @@
 		pBackground->Add(pButtonExit);
 
 		pMessageDialog = new MessageDialog();
-		pMessageDialog->Initialize(pResourceManager);
+		pMessageDialog->Initialize(pServiceProvider);
 		pMessageDialog->Subscribe(GuiDialog::EventResult, &World::OnResult, this);
 
 		const D3DXVECTOR2& kMessageSize = pMessageDialog->GetDimensions();
 		pMessageDialog->SetPosition(0.5f * ((ScreenSizeX - pBackground->GetWidth()) - kMessageSize.x), 0.5f * (ScreenSizeY - kMessageSize.y));
 
 		pConfirmDialog = new ChoiceDialog();
-		pConfirmDialog->Initialize(pResourceManager);
+		pConfirmDialog->Initialize(pServiceProvider);
 		pConfirmDialog->Subscribe(GuiDialog::EventResult, &World::OnConfirm, this);
 
 		const D3DXVECTOR2& kConfigSize = pConfirmDialog->GetDimensions();
 		pConfirmDialog->SetPosition(0.5f * ((ScreenSizeX - pBackground->GetWidth()) - kConfigSize.x), 0.5f * (ScreenSizeY - kConfigSize.y));
 
 		pDebugText = new GuiLabel();
-		pDebugText->Initialize(pResourceManager);
+		pDebugText->Initialize(pServiceProvider);
 		pDebugText->SetFont("Courier New", 16);
 		pDebugText->SetPosition(10.0f, 10.0f);
 		pDebugText->SetText("Debug");
--- a/LightClone/Source/World.h	Tue Oct 04 12:04:09 2011 -0700
+++ b/LightClone/Source/World.h	Tue Oct 04 13:02:45 2011 -0700
@@ -170,7 +170,7 @@
 	/*
 	 * Initialize
 	 */
-	ErrorCode Initialize(ResourceManager* pResource, InputManager* pInput);
+	ErrorCode Initialize(ServiceProvider* pServiceProvider);
 
 	/*
 	 * Terminate
@@ -212,7 +212,7 @@
 	/*
 	 * InitializeInterface
 	 */
-	ErrorCode InitializeInterface(ResourceManager* pResourceManager, InputManager* pInputManager);
+	ErrorCode InitializeInterface(ServiceProvider* pServiceProvider);
 
 	/*
 	 * 	RenderEnvironment