Mercurial > LightClone
changeset 7:31373c5bd1b9
Start on World refactor
author | koryspansel <koryspansel@bendbroadband.com> |
---|---|
date | Fri, 09 Sep 2011 13:21:22 -0700 |
parents | 817a7b518fbb |
children | 968341ab1fb2 |
files | LightClone/LightClone.vcproj LightClone/Source/Mediator.cpp LightClone/Source/Model.cpp LightClone/Source/View.h LightClone/Source/World.cpp LightClone/Source/World.h |
diffstat | 6 files changed, 113 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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" > </File> + <File + RelativePath=".\Source\World.cpp" + > + </File> </Filter> <Filter Name="Header Files" @@ -354,6 +358,10 @@ RelativePath=".\Source\VirtualMachine.h" > </File> + <File + RelativePath=".\Source\World.h" + > + </File> </Filter> <Filter Name="Resource Files"
--- a/LightClone/Source/Mediator.cpp Fri Sep 09 09:57:27 2011 -0700 +++ b/LightClone/Source/Mediator.cpp Fri Sep 09 13:21:22 2011 -0700 @@ -30,24 +30,21 @@ kClock.Reset(); while(pModel->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; }
--- 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, }
--- 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;
--- /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" +
--- /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__