Mercurial > LightClone
view LightClone/Source/Core.h @ 39:d0ce73ced12e
Added base GuiDialog for event handling; Hookup level complete dialog
author | koryspansel <koryspansel@bendbroadband.com> |
---|---|
date | Thu, 22 Sep 2011 09:01:42 -0700 |
parents | c046b9e8ae32 |
children | 91e927584f92 |
line wrap: on
line source
/* * Core */ #ifndef __CORE_H__ #define __CORE_H__ #include "Types.h" #include <d3d9.h> #include <d3dx9.h> #ifdef _DEBUG #include <stdio.h> #define DEBUG_PRINT printf #else #define DEBUG_PRINT(...) #endif /* * GameState */ enum { GameState_Idle, GameState_LoadMap, GameState_Active, GameState_Complete, GameState_Over, GameState_Confirm, GameState_Exit, }; /* * SimulationState */ enum { SimulationState_Idle, SimulationState_Active, }; /* * Action */ enum { Action_Default, Action_Complete, Action_Forward, Action_RotateCW, Action_RotateCCW, Action_Jump, Action_Light, Action_FunctionA, Action_FunctionB, //Action_FunctionC, Action_Count = 7, }; /* * Direction */ enum Direction { Direction_North, Direction_East, Direction_South, Direction_West, Direction_Count, }; /* * Tower */ enum { Tower_Normal, Tower_Light, }; /* * ControlButton */ enum { ControlButton_Play, ControlButton_Stop, ControlButton_Exit, }; /* * DialogButton */ enum { DialogButton_Ok, DialogButton_Yes = DialogButton_Ok, DialogButton_No, }; /* * ScreenSizeX */ const uint32 ScreenSizeX = 1280; /* * ScreenSizeY */ const uint32 ScreenSizeY = 720; /* * FacesPerCube */ const uint32 FacesPerCube = 6; /* * TrianglesPerFace */ const uint32 TrianglesPerFace = 2; /* * VerticesPerTriangle */ const uint32 VerticesPerTriangle = 3; /* * TrianglesPerBlock */ const uint32 TrianglesPerBlock = FacesPerCube * TrianglesPerFace; /* * VerticesPerBlock */ const uint32 VerticesPerBlock = FacesPerCube * TrianglesPerFace * VerticesPerTriangle; /* * MaximumFunctionLength */ const uint32 MaximumFunctionLength = 16; /* * MainFunctionLength */ const uint32 MainFunctionLength = 14; /* * Position * Represents the position of an object on a grid */ struct Position { /* * X */ uint32 X; /* * Y */ uint32 Y; }; /* * Size */ struct Size { /* * X */ uint32 X; /* * Y */ uint32 Y; }; /* * Rectangle2 */ struct Rectangle2 { /* * X */ float X; /* * Y */ float Y; /* * Width */ float Width; /* * Height */ float Height; public: /* * Rectangle2 */ Rectangle2() : X(0.0f), Y(0.0f), Width(0.0f), Height(0.0f) { } /* * Rectangle2 */ Rectangle2(float fX, float fY, float fWidth, float fHeight) : X(fX), Y(fY), Width(fWidth), Height(fHeight) { } /* * Contains */ bool Contains(float fX, float fY) { return (0.0f <= (fX - X) && (fX - X) < Width) && (0.0f <= (fY - Y) && (fY - Y) < Height); } }; /* * Min */ template<typename Type> inline Type Min(Type nValueA, Type nValueB) { return nValueB < nValueA ? nValueB : nValueA; } /* * Max */ template<typename Type> inline Type Max(Type nValueA, Type nValueB) { return nValueB > nValueA ? nValueB : nValueA; } /* * Clamp */ template<typename Type> inline Type Clamp(Type nValue, Type nMinimum, Type nMaximum) { return nValue < nMinimum ? nMinimum : nValue > nMaximum ? nMaximum : nValue; } /* * Abs */ template<typename Type> inline Type Abs(Type nValue) { return nValue < 0 ? -nValue : nValue; } /* * InterpolateDirection */ float InterpolateDirection(uint32 nStart, uint32 nEnd, float fParameter); /* * ComputePickRay */ void ComputePickRay(float fScreenX, float fScreenY, const D3DVIEWPORT9& kViewport, const D3DXMATRIX& kProjection, const D3DXMATRIX& kView, D3DXVECTOR3* pOrigin, D3DXVECTOR3* pDirection); /* * ComputeOrigin */ const D3DXVECTOR3 ComputeOrigin(float fScreenX, float fScreenY, const D3DVIEWPORT9& kViewport, const D3DXMATRIX& kProjection, const D3DXMATRIX& kView); #endif //__CORE_H__