Mercurial > LightClone
changeset 4:d52a7042fa1a
Refactor code panes & VM functions
author | koryspansel |
---|---|
date | Wed, 07 Sep 2011 16:09:39 -0700 |
parents | 6f227dd9a94f |
children | 88b5c4d51c68 |
files | LightClone/LightClone.vcproj LightClone/Source/Bot.cpp LightClone/Source/ButtonPane.cpp LightClone/Source/ButtonPane.h LightClone/Source/Controller.cpp LightClone/Source/Controller.h LightClone/Source/Dialog.cpp LightClone/Source/Dialog.h LightClone/Source/Interface.cpp LightClone/Source/Model.cpp LightClone/Source/Model.h LightClone/ToDo.txt |
diffstat | 12 files changed, 397 insertions(+), 162 deletions(-) [+] |
line wrap: on
line diff
--- a/LightClone/LightClone.vcproj Wed Sep 07 13:47:48 2011 -0700 +++ b/LightClone/LightClone.vcproj Wed Sep 07 16:09:39 2011 -0700 @@ -181,6 +181,10 @@ > </File> <File + RelativePath=".\Source\ButtonPane.cpp" + > + </File> + <File RelativePath=".\Source\CameraController.cpp" > </File> @@ -201,6 +205,10 @@ > </File> <File + RelativePath=".\Source\Dialog.cpp" + > + </File> + <File RelativePath=".\Source\DragController.cpp" > </File> @@ -267,6 +275,10 @@ > </File> <File + RelativePath=".\Source\ButtonPane.h" + > + </File> + <File RelativePath=".\Source\CameraController.h" > </File> @@ -287,6 +299,10 @@ > </File> <File + RelativePath=".\Source\Dialog.h" + > + </File> + <File RelativePath=".\Source\DragController.h" > </File>
--- a/LightClone/Source/Bot.cpp Wed Sep 07 13:47:48 2011 -0700 +++ b/LightClone/Source/Bot.cpp Wed Sep 07 16:09:39 2011 -0700 @@ -134,15 +134,26 @@ { ErrorCode eCode = Error_Success; + kMachine.Reset(); + kMachine.ClearMemory(); + + kMachine.RemoveAllFunctions(); + kMachine.AddFunction(0, (uint8)MainFunctionLength * 2); + for(uint32 i = 0; i < nCount && eCode == Error_Success; ++i) { + kMachine.AddFunction(i + 1, (uint8)pCode[i].GetSize() * 2); + uint32 nSize = kMachine.GetFunctionSize(i); uint8* pData = kMachine.GetFunctionMemory(i); eCode = Compile(pCode + i, pData, nSize); } - nState = BotState_Evaluate; + if(eCode == Error_Success) + { + nState = BotState_Evaluate; + } return eCode; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LightClone/Source/ButtonPane.cpp Wed Sep 07 16:09:39 2011 -0700 @@ -0,0 +1,64 @@ +/* + * ButtonPane + */ + +#include "ButtonPane.h" + +/* + * ButtonPane + */ +ButtonPane::ButtonPane(uint32 nMax) : nMaximum(nMax), nSize(0) +{ + pBounds = new Rectangle2[nMax]; +} + +/* + * Add + */ +void ButtonPane::Add(float fX, float fY, float fWidth, float fHeight) +{ + if(nSize < nMaximum) + { + pBounds[nSize++] = Rectangle2(fX, fY, fWidth, fHeight); + } +} + +/* + * Pick + */ +int32 ButtonPane::Pick(float fX, float fY) +{ + for(uint32 i = 0; i < nMaximum; ++i) + { + if(pBounds[i].Contains(fX, fY)) + { + return (int32)i; + } + } + + return -1; +} + +/* + * GetMaximum + */ +uint32 ButtonPane::GetMaximum() const +{ + return nMaximum; +} + +/* + * GetSize + */ +uint32 ButtonPane::GetSize() const +{ + return nSize; +} + +/* + * GetBounds + */ +const Rectangle2& ButtonPane::GetBounds(uint32 nSlot) const +{ + return pBounds[nSlot]; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LightClone/Source/ButtonPane.h Wed Sep 07 16:09:39 2011 -0700 @@ -0,0 +1,65 @@ +/* + * ButtonPane + */ + +#ifndef __BUTTONPANE_H__ +#define __BUTTONPANE_H__ + +#include "Core.h" + +/* + * ButtonPane + */ +class ButtonPane +{ +private: + + /* + * nMaximum + */ + uint32 nMaximum; + + /* + * nSize + */ + uint32 nSize; + + /* + * pBounds + */ + Rectangle2* pBounds; + +public: + + /* + * ButtonPane + */ + ButtonPane(uint32 nMax); + + /* + * Add + */ + void Add(float fX, float fY, float fWidth, float fHeight); + + /* + * Pick + */ + int32 Pick(float fX, float fY); + + /* + * GetMaximum + */ + uint32 GetMaximum() const; + + /* + * GetSize + */ + uint32 GetSize() const; + + /* + * GetBounds + */ + const Rectangle2& GetBounds(uint32 nSlot) const; +}; + +#endif //__BUTTONPANE_H__
--- a/LightClone/Source/Controller.cpp Wed Sep 07 13:47:48 2011 -0700 +++ b/LightClone/Source/Controller.cpp Wed Sep 07 16:09:39 2011 -0700 @@ -61,6 +61,9 @@ Environment* pEnvironment = pModel->GetEnvironment(); if(pEnvironment->RequirementsMet()) { + //kDialog.Reset(); + //kDialog.SetMessage("Some message"); + //kDialog.SetButton(0, "Ok"); pModel->nGameState = GameState_Complete; } } @@ -69,34 +72,6 @@ } /* - * Start - */ -void Controller::Start() -{ - if(pModel->nSimulationState == SimulationState_Idle) - { - pModel->ResetBot(); - pModel->GetBot()->Upload(pModel->GetFunction(0), pModel->GetFunctionCount()); - - pModel->nSimulationState = SimulationState_Active; - } -} - -/* - * Stop - */ -void Controller::Stop() -{ - if(pModel->nSimulationState == SimulationState_Active) - { - pModel->ResetEnvironment(); - pModel->ResetBot(); - - pModel->nSimulationState = SimulationState_Idle; - } -} - -/* * ProcessInput */ void Controller::ProcessInput(float fElapsed) @@ -145,62 +120,84 @@ { if(pModel->kInputManager.IsButtonDown(0) && !pModel->kInputManager.WasButtonDown(0)) { - if(pModel->kControlBounds[ControlButton_Play].Contains(fMouseX, fMouseY)) + int32 nSelection = pModel->kControls.Pick(fMouseX, fMouseY); + if(nSelection >= 0) { - Start(); - } - else + if(nSelection == ControlButton_Play) + { + if(pModel->nSimulationState == SimulationState_Idle) + { + pModel->ResetBot(); + pModel->GetBot()->Upload(pModel->GetFunction(0), pModel->GetFunctionCount()); - if(pModel->kControlBounds[ControlButton_Stop].Contains(fMouseX, fMouseY)) - { - Stop(); - } - else + pModel->nSimulationState = SimulationState_Active; + } + } + else - if(pModel->kControlBounds[ControlButton_Exit].Contains(fMouseX, fMouseY)) - { - pModel->nGameState = GameState_Exit; - } + if(nSelection == ControlButton_Stop) + { + if(pModel->nSimulationState == SimulationState_Active) + { + pModel->ResetEnvironment(); + pModel->ResetBot(); - for(uint32 i = 0; i < sizeof(pModel->kArrowBounds) / sizeof(pModel->kArrowBounds[0]); ++i) - { - if(pModel->kArrowBounds[i].Contains(fMouseX, fMouseY)) + pModel->nSimulationState = SimulationState_Idle; + } + } + else + + if(nSelection == ControlButton_Exit) { - const uint32 nCount = pModel->GetFunctionCount() - 1; - pModel->nCurrentFunction = (pModel->nCurrentFunction + 2 * (int32)i - 1 + nCount) % nCount; + pModel->nGameState = GameState_Exit; } } - - for(uint32 i = 0; i < Action_Count; ++i) + else { - if(pModel->kActionBounds[i].Contains(fMouseX, fMouseY)) + // pick against the toolbar + nSelection = pModel->kToolbar.Pick(fMouseX, fMouseY); + if(nSelection >= 0) { - pModel->kDragController.Begin(Action_Forward + i); + pModel->kDragController.Begin(Action_Forward + nSelection); } - } - - for(uint32 i = 0; i < sizeof(pModel->kMainBounds) / sizeof(pModel->kMainBounds[0]); ++i) - { - if(pModel->kMainBounds[i].Contains(fMouseX, fMouseY)) + else { - Code* pCode = pModel->GetFunction(0); - if(!pCode->IsEmptySlot(i)) + // pick against the main pane + nSelection = pModel->kMain.Pick(fMouseX, fMouseY); + if(nSelection >= 0) + { + Code* pCode = pModel->GetFunction(0); + if(!pCode->IsEmptySlot(nSelection)) + { + pModel->kDragController.Begin(pCode->GetSlot(nSelection)); + pCode->ClearSlot(nSelection); + } + } + else { - pModel->kDragController.Begin(pCode->GetSlot(i)); - pCode->ClearSlot(i); - } - } - } - - for(uint32 i = 0; i < sizeof(pModel->kFunctionBounds) / sizeof(pModel->kFunctionBounds[0]); ++i) - { - if(pModel->kFunctionBounds[i].Contains(fMouseX, fMouseY)) - { - Code* pCode = pModel->GetFunction(pModel->nCurrentFunction + 1); - if(!pCode->IsEmptySlot(i)) - { - pModel->kDragController.Begin(pCode->GetSlot(i)); - pCode->ClearSlot(i); + // pick against the function pane + nSelection = pModel->kFunction.Pick(fMouseX, fMouseY); + if(nSelection >= 0) + { + Code* pCode = pModel->GetFunction(pModel->nCurrentFunction + 1); + if(!pCode->IsEmptySlot(nSelection)) + { + pModel->kDragController.Begin(pCode->GetSlot(nSelection)); + pCode->ClearSlot(nSelection); + } + } + else + { + // pick against the function pane arrows + for(uint32 i = 0; i < sizeof(pModel->kArrowBounds) / sizeof(pModel->kArrowBounds[0]); ++i) + { + if(pModel->kArrowBounds[i].Contains(fMouseX, fMouseY)) + { + const uint32 nCount = pModel->GetFunctionCount() - 1; + pModel->nCurrentFunction = (pModel->nCurrentFunction + 2 * (int32)i - 1 + nCount) % nCount; + } + } + } } } } @@ -213,19 +210,17 @@ { const uint32 nAction = pModel->kDragController.End(); - for(uint32 i = 0; i < sizeof(pModel->kMainBounds) / sizeof(pModel->kMainBounds[0]); ++i) + int32 nSelection = pModel->kMain.Pick(fMouseX, fMouseY); + if(nSelection >= 0) { - if(pModel->kMainBounds[i].Contains(fMouseX, fMouseY)) - { - pModel->GetFunction(0)->SetSlot(i, nAction); - } + pModel->GetFunction(0)->SetSlot(nSelection, nAction); } - - for(uint32 i = 0; i < sizeof(pModel->kFunctionBounds) / sizeof(pModel->kFunctionBounds[0]); ++i) + else { - if(pModel->kFunctionBounds[i].Contains(fMouseX, fMouseY)) + nSelection = pModel->kFunction.Pick(fMouseX, fMouseY); + if(nSelection >= 0) { - pModel->GetFunction(pModel->nCurrentFunction + 1)->SetSlot(i, nAction); + pModel->GetFunction(pModel->nCurrentFunction + 1)->SetSlot(nSelection, nAction); } } } @@ -235,7 +230,6 @@ if(pModel->nGameState == GameState_Complete) { - // check to see if button was clicked if(pModel->kInputManager.IsButtonDown(0) && !pModel->kInputManager.WasButtonDown(0)) { for(uint32 i = 0; i < sizeof(pModel->kDialog1Bounds) / sizeof(pModel->kDialog1Bounds[0]); ++i)
--- a/LightClone/Source/Controller.h Wed Sep 07 13:47:48 2011 -0700 +++ b/LightClone/Source/Controller.h Wed Sep 07 16:09:39 2011 -0700 @@ -48,16 +48,6 @@ private: /* - * Start - */ - void Start(); - - /* - * Stop - */ - void Stop(); - - /* * ProcessInput */ void ProcessInput(float fElapsed);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LightClone/Source/Dialog.cpp Wed Sep 07 16:09:39 2011 -0700 @@ -0,0 +1,21 @@ +/* + * Dialog + */ + +#include "Dialog.h" + +/* + * kDialogBounds + */ +Rectangle2 kDialogBounds[][Dialog::MaximumButtonCount] = +{ + { + Rectangle2(1023.0f + 2.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f), + Rectangle2(1023.0f + 2.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f), + }, + + { + Rectangle2(1023.0f + 2.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f), + Rectangle2(1023.0f + 2.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f), + }, +};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LightClone/Source/Dialog.h Wed Sep 07 16:09:39 2011 -0700 @@ -0,0 +1,48 @@ +/* + * Dialog + */ + +#ifndef __DIALOG_H__ +#define __DIALOG_H__ + +#include "Core.h" + +/* + * Dialog + */ +class Dialog +{ +public: + + /* + * MaximumButtonCount + */ + static const uint32 MaximumButtonCount = 2; + + /* + * MaximumMessageLength + */ + static const uint32 MaximumMessageLength = 256; + +private: + + /* + * kMessage + */ + char kMessage[MaximumMessageLength]; + +public: + + /* + * Dialog + */ + Dialog(); + + /* + * SetButton + */ + void SetButton(uint32 nButton, const char* pMessage); + +}; + +#endif //__DIALOG_H__
--- a/LightClone/Source/Interface.cpp Wed Sep 07 13:47:48 2011 -0700 +++ b/LightClone/Source/Interface.cpp Wed Sep 07 16:09:39 2011 -0700 @@ -338,11 +338,14 @@ for(uint32 i = 0; i < Action_Count; ++i) { + const Rectangle2& kBounds = pModel->kToolbar.GetBounds(i); + D3DXMATRIX kScale; - D3DXMatrixScaling(&kScale, pModel->kActionBounds[i].Width, pModel->kActionBounds[i].Height, 1.0f); + //D3DXMatrixScaling(&kScale, pModel->kActionBounds[i].Width, pModel->kActionBounds[i].Height, 1.0f); + D3DXMatrixScaling(&kScale, kBounds.Width, kBounds.Height, 1.0f); D3DXMATRIX kTranslate; - D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + pModel->kActionBounds[i].X, 0.5f * ScreenSizeY - pModel->kActionBounds[i].Y, 0.0f); + D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + kBounds.X, 0.5f * ScreenSizeY - kBounds.Y, 0.0f); D3DXMATRIX kWorldMatrix; D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate); @@ -366,17 +369,19 @@ { const D3DXVECTOR4 kColorVector(1.0f, 1.0f, 1.0f, 1.0f); - for(uint32 i = 0; i < Max(pCode->GetSize(), 16U); ++i) + 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, pModel->kMainBounds[i].Width, pModel->kMainBounds[i].Height, 1.0f); + D3DXMatrixScaling(&kScale, kBounds.Width, kBounds.Height, 1.0f); D3DXMATRIX kTranslate; - D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + pModel->kMainBounds[i].X, 0.5f * ScreenSizeY - pModel->kMainBounds[i].Y, 0.0f); + D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + kBounds.X, 0.5f * ScreenSizeY - kBounds.Y, 0.0f); D3DXMATRIX kWorldMatrix; D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate); @@ -410,17 +415,21 @@ { const D3DXVECTOR4 kColorVector(1.0f, 1.0f, 1.0f, 1.0f); - for(uint32 i = 0; i < Max(pCode->GetSize(), 8U); ++i) + //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, pModel->kFunctionBounds[i].Width, pModel->kFunctionBounds[i].Height, 1.0f); + D3DXMatrixScaling(&kScale, kBounds.Width, kBounds.Height, 1.0f); D3DXMATRIX kTranslate; - D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + pModel->kFunctionBounds[i].X, 0.5f * ScreenSizeY - pModel->kFunctionBounds[i].Y, 0.0f); + D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + kBounds.X, 0.5f * ScreenSizeY - kBounds.Y, 0.0f); D3DXMATRIX kWorldMatrix; D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate); @@ -481,13 +490,16 @@ { const D3DXVECTOR4 kColorVector(1.0f, 1.0f, 1.0f, 1.0f); - for(uint32 i = 0; i < sizeof(pModel->kControlBounds) / sizeof(pModel->kControlBounds[0]); ++i) + //for(uint32 i = 0; i < sizeof(pModel->kControlBounds) / sizeof(pModel->kControlBounds[0]); ++i) + for(uint32 i = 0; i < pModel->kControls.GetSize(); ++i) { + const Rectangle2& kBounds = pModel->kControls.GetBounds(i); + D3DXMATRIX kScale; - D3DXMatrixScaling(&kScale, pModel->kControlBounds[i].Width, pModel->kControlBounds[i].Height, 1.0f); + D3DXMatrixScaling(&kScale, kBounds.Width, kBounds.Height, 1.0f); D3DXMATRIX kTranslate; - D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + pModel->kControlBounds[i].X, 0.5f * ScreenSizeY - pModel->kControlBounds[i].Y, 0.0f); + D3DXMatrixTranslation(&kTranslate, -0.5f * ScreenSizeX + kBounds.X, 0.5f * ScreenSizeY - kBounds.Y, 0.0f); D3DXMATRIX kWorldMatrix; D3DXMatrixMultiply(&kWorldMatrix, &kScale, &kTranslate);
--- a/LightClone/Source/Model.cpp Wed Sep 07 13:47:48 2011 -0700 +++ b/LightClone/Source/Model.cpp Wed Sep 07 16:09:39 2011 -0700 @@ -7,7 +7,7 @@ /* * Model */ -Model::Model() +Model::Model() : kToolbar(Action_Count), kMain(MaximumFunctionLength), kFunction(MaximumFunctionLength / 2), kControls(4) { nGameState = GameState_Active; nSimulationState = SimulationState_Idle; @@ -15,52 +15,52 @@ nCurrentFunction = 0; nCurrentLevel = 0; - kActionBounds[0] = Rectangle2(1023.0f + 0 * 54.0f, 85.0f + 0 * 54.0f, 48.0f, 48.0f); - kActionBounds[1] = Rectangle2(1023.0f + 1 * 54.0f, 85.0f + 0 * 54.0f, 48.0f, 48.0f); - kActionBounds[2] = Rectangle2(1023.0f + 2 * 54.0f, 85.0f + 0 * 54.0f, 48.0f, 48.0f); - kActionBounds[3] = Rectangle2(1023.0f + 3 * 54.0f, 85.0f + 0 * 54.0f, 48.0f, 48.0f); - kActionBounds[4] = Rectangle2(1023.0f + 0 * 54.0f, 85.0f + 1 * 54.0f, 48.0f, 48.0f); - kActionBounds[5] = Rectangle2(1023.0f + 1 * 54.0f, 85.0f + 1 * 54.0f, 48.0f, 48.0f); - kActionBounds[6] = Rectangle2(1023.0f + 2 * 54.0f, 85.0f + 1 * 54.0f, 48.0f, 48.0f); - kActionBounds[7] = Rectangle2(1023.0f + 3 * 54.0f, 85.0f + 1 * 54.0f, 48.0f, 48.0f); - - kMainBounds[0] = Rectangle2(1023.0f + 0 * 54.0f, 238.0f + 0 * 54.0f, 48.0f, 48.0f); - kMainBounds[1] = Rectangle2(1023.0f + 1 * 54.0f, 238.0f + 0 * 54.0f, 48.0f, 48.0f); - kMainBounds[2] = Rectangle2(1023.0f + 2 * 54.0f, 238.0f + 0 * 54.0f, 48.0f, 48.0f); - kMainBounds[3] = Rectangle2(1023.0f + 3 * 54.0f, 238.0f + 0 * 54.0f, 48.0f, 48.0f); - kMainBounds[4] = Rectangle2(1023.0f + 0 * 54.0f, 238.0f + 1 * 54.0f, 48.0f, 48.0f); - kMainBounds[5] = Rectangle2(1023.0f + 1 * 54.0f, 238.0f + 1 * 54.0f, 48.0f, 48.0f); - kMainBounds[6] = Rectangle2(1023.0f + 2 * 54.0f, 238.0f + 1 * 54.0f, 48.0f, 48.0f); - kMainBounds[7] = Rectangle2(1023.0f + 3 * 54.0f, 238.0f + 1 * 54.0f, 48.0f, 48.0f); - kMainBounds[8] = Rectangle2(1023.0f + 0 * 54.0f, 238.0f + 2 * 54.0f, 48.0f, 48.0f); - kMainBounds[9] = Rectangle2(1023.0f + 1 * 54.0f, 238.0f + 2 * 54.0f, 48.0f, 48.0f); - kMainBounds[10] = Rectangle2(1023.0f + 2 * 54.0f, 238.0f + 2 * 54.0f, 48.0f, 48.0f); - kMainBounds[11] = Rectangle2(1023.0f + 3 * 54.0f, 238.0f + 2 * 54.0f, 48.0f, 48.0f); - kMainBounds[12] = Rectangle2(1023.0f + 0 * 54.0f, 238.0f + 3 * 54.0f, 48.0f, 48.0f); - kMainBounds[13] = Rectangle2(1023.0f + 1 * 54.0f, 238.0f + 3 * 54.0f, 48.0f, 48.0f); - kMainBounds[14] = Rectangle2(1023.0f + 2 * 54.0f, 238.0f + 3 * 54.0f, 48.0f, 48.0f); - kMainBounds[15] = Rectangle2(1023.0f + 3 * 54.0f, 238.0f + 3 * 54.0f, 48.0f, 48.0f); - - kFunctionBounds[0] = Rectangle2(1023.0f + 0 * 54.0f, 501.0f + 0 * 54.0f, 48.0f, 48.0f); - kFunctionBounds[1] = Rectangle2(1023.0f + 1 * 54.0f, 501.0f + 0 * 54.0f, 48.0f, 48.0f); - kFunctionBounds[2] = Rectangle2(1023.0f + 2 * 54.0f, 501.0f + 0 * 54.0f, 48.0f, 48.0f); - kFunctionBounds[3] = Rectangle2(1023.0f + 3 * 54.0f, 501.0f + 0 * 54.0f, 48.0f, 48.0f); - kFunctionBounds[4] = Rectangle2(1023.0f + 0 * 54.0f, 501.0f + 1 * 54.0f, 48.0f, 48.0f); - kFunctionBounds[5] = Rectangle2(1023.0f + 1 * 54.0f, 501.0f + 1 * 54.0f, 48.0f, 48.0f); - kFunctionBounds[6] = Rectangle2(1023.0f + 2 * 54.0f, 501.0f + 1 * 54.0f, 48.0f, 48.0f); - kFunctionBounds[7] = Rectangle2(1023.0f + 3 * 54.0f, 501.0f + 1 * 54.0f, 48.0f, 48.0f); - kArrowBounds[0] = Rectangle2(1206.0f + 0 * 16.0f, 473.0f + 0 * 54.0f, 16.0f, 16.0f); kArrowBounds[1] = Rectangle2(1206.0f + 2 * 16.0f, 473.0f + 0 * 54.0f, 16.0f, 16.0f); - kControlBounds[0] = Rectangle2(1023.0f + 0.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); - kControlBounds[1] = Rectangle2(1023.0f + 1.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); - kControlBounds[2] = Rectangle2(1023.0f + 2.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); - kDialog1Bounds[0] = Rectangle2(1023.0f + 2.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); kDialog2Bounds[0] = Rectangle2(1023.0f + 2.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); kDialog2Bounds[1] = Rectangle2(1023.0f + 2.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); + + kToolbar.Add(1023.0f + 0 * 54.0f, 85.0f + 0 * 54.0f, 48.0f, 48.0f); + kToolbar.Add(1023.0f + 1 * 54.0f, 85.0f + 0 * 54.0f, 48.0f, 48.0f); + kToolbar.Add(1023.0f + 2 * 54.0f, 85.0f + 0 * 54.0f, 48.0f, 48.0f); + kToolbar.Add(1023.0f + 3 * 54.0f, 85.0f + 0 * 54.0f, 48.0f, 48.0f); + kToolbar.Add(1023.0f + 0 * 54.0f, 85.0f + 1 * 54.0f, 48.0f, 48.0f); + kToolbar.Add(1023.0f + 1 * 54.0f, 85.0f + 1 * 54.0f, 48.0f, 48.0f); + kToolbar.Add(1023.0f + 2 * 54.0f, 85.0f + 1 * 54.0f, 48.0f, 48.0f); + kToolbar.Add(1023.0f + 3 * 54.0f, 85.0f + 1 * 54.0f, 48.0f, 48.0f); + + kMain.Add(1023.0f + 0 * 54.0f, 238.0f + 0 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 1 * 54.0f, 238.0f + 0 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 2 * 54.0f, 238.0f + 0 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 3 * 54.0f, 238.0f + 0 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 0 * 54.0f, 238.0f + 1 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 1 * 54.0f, 238.0f + 1 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 2 * 54.0f, 238.0f + 1 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 3 * 54.0f, 238.0f + 1 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 0 * 54.0f, 238.0f + 2 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 1 * 54.0f, 238.0f + 2 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 2 * 54.0f, 238.0f + 2 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 3 * 54.0f, 238.0f + 2 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 0 * 54.0f, 238.0f + 3 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 1 * 54.0f, 238.0f + 3 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 2 * 54.0f, 238.0f + 3 * 54.0f, 48.0f, 48.0f); + kMain.Add(1023.0f + 3 * 54.0f, 238.0f + 3 * 54.0f, 48.0f, 48.0f); + + kFunction.Add(1023.0f + 0 * 54.0f, 501.0f + 0 * 54.0f, 48.0f, 48.0f); + kFunction.Add(1023.0f + 1 * 54.0f, 501.0f + 0 * 54.0f, 48.0f, 48.0f); + kFunction.Add(1023.0f + 2 * 54.0f, 501.0f + 0 * 54.0f, 48.0f, 48.0f); + kFunction.Add(1023.0f + 3 * 54.0f, 501.0f + 0 * 54.0f, 48.0f, 48.0f); + kFunction.Add(1023.0f + 0 * 54.0f, 501.0f + 1 * 54.0f, 48.0f, 48.0f); + kFunction.Add(1023.0f + 1 * 54.0f, 501.0f + 1 * 54.0f, 48.0f, 48.0f); + kFunction.Add(1023.0f + 2 * 54.0f, 501.0f + 1 * 54.0f, 48.0f, 48.0f); + kFunction.Add(1023.0f + 3 * 54.0f, 501.0f + 1 * 54.0f, 48.0f, 48.0f); + + kControls.Add(1023.0f + 0.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); + kControls.Add(1023.0f + 1.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); + kControls.Add(1023.0f + 2.5f * 54.0f, 638.0f + 0 * 00.0f, 48.0f, 48.0f); } /* @@ -101,16 +101,12 @@ pFunction[0].Initialize(MainFunctionLength); pFunction[0].Clear(); - kBot.AddFunction(0, MainFunctionLength); - for(uint32 i = 0; i < nCount; ++i) { const uint32 nLength = kLoader.GetFunctionLength(i); pFunction[i + 1].Initialize(nLength); pFunction[i + 1].Clear(); - - kBot.AddFunction(i + 1, nLength); } } }
--- a/LightClone/Source/Model.h Wed Sep 07 13:47:48 2011 -0700 +++ b/LightClone/Source/Model.h Wed Sep 07 16:09:39 2011 -0700 @@ -12,6 +12,7 @@ #include "Loader.h" #include "InputManager.h" #include "DragController.h" +#include "ButtonPane.h" /* * GameState @@ -86,19 +87,44 @@ public: /* + * kInputManager + */ + InputManager kInputManager; + + /* + * kDragController + */ + DragController kDragController; + + /* * kActionBounds */ - Rectangle2 kActionBounds[8]; + //Rectangle2 kActionBounds[8]; + + /* + * kToolbar + */ + ButtonPane kToolbar; /* * kMainBounds */ - Rectangle2 kMainBounds[16]; + //Rectangle2 kMainBounds[16]; + + /* + * kMain + */ + ButtonPane kMain; /* * kFunctionBounds */ - Rectangle2 kFunctionBounds[8]; + //Rectangle2 kFunctionBounds[8]; + + /* + * kFunction + */ + ButtonPane kFunction; /* * kArrowBounds @@ -108,7 +134,8 @@ /* * kControlBounds */ - Rectangle2 kControlBounds[3]; + //Rectangle2 kControlBounds[3]; + ButtonPane kControls; /* * kDialog1Bounds @@ -120,16 +147,6 @@ */ Rectangle2 kDialog2Bounds[2]; - /* - * kInputManager - */ - InputManager kInputManager; - - /* - * kDragController - */ - DragController kDragController; - public: /*