# HG changeset patch # User koryspansel # Date 1315599682 25200 # Node ID 31373c5bd1b91ca6a486f3a3aed5ffd8b7684acc # Parent 817a7b518fbbd6aae42bc1910db6b5d336cfec66 Start on World refactor diff -r 817a7b518fbb -r 31373c5bd1b9 LightClone/LightClone.vcproj --- a/LightClone/LightClone.vcproj Fri Sep 09 09:57:27 2011 -0700 +++ b/LightClone/LightClone.vcproj Fri Sep 09 13:21:22 2011 -0700 @@ -264,6 +264,10 @@ RelativePath=".\Source\VirtualMachine.cpp" > + + + + nGameState != GameState_Exit) + //while(pWorld->IsActive()) { ProcessMessages(); - float fElapsed = kClock.GetElapsed(); - if(fElapsed > 2 * fUpdatePeriod) - { - fElapsed = 2 * fUpdatePeriod; - } - - fAccumulator += fElapsed; - + fAccumulator += Min(kClock.GetElapsed(), fUpdatePeriod); while(fAccumulator >= fUpdatePeriod) { Update(fUpdatePeriod); fAccumulator -= fUpdatePeriod; } - Render(); + //if(updated) + { + Render(); + } } Terminate(); @@ -64,10 +61,14 @@ pModel = new Model(); pView = new View(pModel); pController = new Controller(pModel, pView); + //pWorld = new World(); ErrorCode eCode = pView->Initialize(); + //eCode = pWorld->Initialize(); if(eCode == Error_Success) { + //pWorld->Activate(); + eCode = pController->Initialize(); if(eCode == Error_Success) { @@ -84,6 +85,16 @@ */ void Mediator::Terminate() { + /* + if(pWorld) + { + pWorld->Terminate(); + + delete pWorld; + pWorld = NULL; + } + */ + if(pController) { pController->Terminate(); @@ -110,6 +121,7 @@ void Mediator::Update(float fElapsed) { pController->Update(fElapsed); + //pWorld->Update(fElapsed); } /* @@ -118,6 +130,7 @@ void Mediator::Render() { pView->Render(); + //pWorld->Render(); } /* @@ -132,6 +145,7 @@ if(kMessage.message == WM_QUIT) { pModel->nGameState = GameState_Exit; + //pWorld->Deactivate(); break; } diff -r 817a7b518fbb -r 31373c5bd1b9 LightClone/Source/Model.cpp --- a/LightClone/Source/Model.cpp Fri Sep 09 09:57:27 2011 -0700 +++ b/LightClone/Source/Model.cpp Fri Sep 09 13:21:22 2011 -0700 @@ -5,6 +5,27 @@ #include "Model.h" /* +World + Update + Update WorldObjects + + Render3D + Setup 3D Projection + Render Environment + Render Bot + + Render2D + Interface + + +WorldObject Concerns: + Initialization & Resource Loading + Updating + Rendering + Termination +*/ + +/* * Model */ Model::Model() : kToolbar(Action_Count), kMain(MaximumFunctionLength), kFunction(MaximumFunctionLength / 2), kControls(4) @@ -180,7 +201,7 @@ */ void Model::SetupDialog(const char* pMessage, const char* pChoiceA, uint32 nResultA, const char* pChoiceB, uint32 nResultB) { - kDialog.Reset("Some message"); + //kDialog.Reset("Some message"); //kDialog.AddButton(DialogButton_Ok, "Ok", 0.0f, 0.0f, 0.0f, 0.0f); - kDialog.AddButton(nResultA, pMessageA, + //kDialog.AddButton(nResultA, pMessageA, } diff -r 817a7b518fbb -r 31373c5bd1b9 LightClone/Source/View.h --- a/LightClone/Source/View.h Fri Sep 09 09:57:27 2011 -0700 +++ b/LightClone/Source/View.h Fri Sep 09 13:21:22 2011 -0700 @@ -18,46 +18,56 @@ { /* * pView + * Replace this with the Mediator */ static View* pView; /* * pModel + * Remove */ Model* pModel; /* * kWindow + * Move to Mediator; Anything requiring access to the window will need to + * be owned and initialized by the Mediator. */ HWND kWindow; /* * kContext + * Move to Mediator */ RenderContext kContext; /* * kCameraController + * Move to World */ CameraController kCameraController; /* * pBlockEffect + * Move to World */ ID3DXEffect* pBlockEffect; /* * pBlockVertexBuffer + * Move to World */ IDirect3DVertexBuffer9* pBlockVertexBuffer; /* * pBlockTexture + * Move to World */ IDirect3DTexture9* pBlockTexture; /* * kInterface + * Move to World */ Interface kInterface; diff -r 817a7b518fbb -r 31373c5bd1b9 LightClone/Source/World.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LightClone/Source/World.cpp Fri Sep 09 13:21:22 2011 -0700 @@ -0,0 +1,6 @@ +/* + * World + */ + +#include "World.h" + diff -r 817a7b518fbb -r 31373c5bd1b9 LightClone/Source/World.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LightClone/Source/World.h Fri Sep 09 13:21:22 2011 -0700 @@ -0,0 +1,43 @@ +/* + * World + */ + +#ifndef __WORLD_H__ +#define __WORLD_H__ + +#include "Core.h" + +/* + * World + */ +class World +{ +public: + + /* + * World + */ + World(); + + /* + * Initialize + */ + ErrorCode Initialize(); + + /* + * Terminate + */ + void Terminate(); + + /* + * Update + */ + void Update(float fElapsed); + + /* + * Render + */ + void Render(); +}; + +#endif //__WORLD_H__