summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Peeten <dpeeten@onsneteindhoven.nl>2008-04-22 13:32:09 (GMT)
committerDennis Peeten <dpeeten@onsneteindhoven.nl>2008-04-22 13:32:09 (GMT)
commit2b53b94bdc1815fbc73f7ef0e5c2400f42a55508 (patch)
treed88af88abd415094b636a968d1640bf205bbb1c7
parent92f2ef5fa1b80c6491ce46eab0ab0908eb9be9cc (diff)
download2iv55-2b53b94bdc1815fbc73f7ef0e5c2400f42a55508.zip
2iv55-2b53b94bdc1815fbc73f7ef0e5c2400f42a55508.tar.gz
2iv55-2b53b94bdc1815fbc73f7ef0e5c2400f42a55508.tar.bz2
Initial check in MatchBloxEngine
-rw-r--r--MatchBloxEngine/MatchBloxEngine.sln20
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_3DObject.cpp28
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_3DObject.h30
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_Block.cpp49
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_Block.h31
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_Hand.cpp41
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_Hand.h31
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_Log.cpp24
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_Log.h19
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp42
-rw-r--r--MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.h55
-rw-r--r--MatchBloxEngine/MatchBloxEngine/MatchBloxEngine.vcproj249
-rw-r--r--MatchBloxEngine/MatchBloxEngine/MessageQueue.h19
-rw-r--r--MatchBloxEngine/MatchBloxEngine/main.cpp129
14 files changed, 767 insertions, 0 deletions
diff --git a/MatchBloxEngine/MatchBloxEngine.sln b/MatchBloxEngine/MatchBloxEngine.sln
new file mode 100644
index 0000000..a924ae9
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MatchBloxEngine", "MatchBloxEngine\MatchBloxEngine.vcproj", "{76B80F87-6EFD-4439-9D32-86FA7BD83035}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {76B80F87-6EFD-4439-9D32-86FA7BD83035}.Debug|Win32.ActiveCfg = Debug|Win32
+ {76B80F87-6EFD-4439-9D32-86FA7BD83035}.Debug|Win32.Build.0 = Debug|Win32
+ {76B80F87-6EFD-4439-9D32-86FA7BD83035}.Release|Win32.ActiveCfg = Release|Win32
+ {76B80F87-6EFD-4439-9D32-86FA7BD83035}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/MatchBloxEngine/MatchBloxEngine/C_3DObject.cpp b/MatchBloxEngine/MatchBloxEngine/C_3DObject.cpp
new file mode 100644
index 0000000..a7482c7
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/C_3DObject.cpp
@@ -0,0 +1,28 @@
+#include <GL/glut.h>
+#include "C_3DObject.h"
+
+
+C_3DObject::C_3DObject(char* f_strFileName)
+{
+ //init position rotation and scale
+ m_d3Pos[0] = m_d3Pos[1] = m_d3Pos[2] = 0.0;
+ m_d3Rot[0] = m_d3Rot[1] = m_d3Rot[2] = 0.0;
+ m_d3Scale[0] = m_d3Scale[1] = m_d3Scale[2] = 1.0;
+
+ //load 3d model
+ //Load(f_strFileName);
+}
+
+void C_3DObject::TransRotateScale()
+{
+ glRotated(m_d3Rot[2], 0.0, 0.0, 1.0);
+ glRotated(m_d3Rot[0], 1.0, 0.0, 0.0);
+ glRotated(m_d3Rot[1], 0.0, 1.0, 0.0);
+ glTranslated(m_d3Pos[0], m_d3Pos[1], m_d3Pos[2]);
+ glScaled(m_d3Scale[0], m_d3Scale[1], m_d3Scale[2]);
+}
+
+void C_3DObject::Draw()
+{
+ glutSolidCube(1.0);
+} \ No newline at end of file
diff --git a/MatchBloxEngine/MatchBloxEngine/C_3DObject.h b/MatchBloxEngine/MatchBloxEngine/C_3DObject.h
new file mode 100644
index 0000000..9f194cc
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/C_3DObject.h
@@ -0,0 +1,30 @@
+#ifndef C_3DOBJECT_HEADER_FILE
+
+#define C_3DOBJECT_HEADER_FILE
+
+class C_3DObject
+{
+public:
+ C_3DObject(char* f_strFileName);
+ ~C_3DObject();
+
+ inline void SetPos(double f_dX, double f_dY, double f_dZ) { m_d3Pos[0] = f_dX; m_d3Pos[1] = f_dY; m_d3Pos[2] = f_dZ; }
+ inline void SetRot(double f_dX, double f_dY, double f_dZ) { m_d3Rot[0] = f_dX; m_d3Rot[1] = f_dY; m_d3Rot[2] = f_dZ; }
+ inline void SetScale(double f_dX, double f_dY, double f_dZ) { m_d3Scale[0] = f_dX; m_d3Scale[1] = f_dY; m_d3Scale[2] = f_dZ; }
+
+ inline double* GetPos() { return m_d3Pos; }
+ inline double* GetRot() { return m_d3Rot; }
+ inline double* GetScale() { return m_d3Scale; }
+
+ void TransRotateScale();
+ virtual void Draw();
+
+protected:
+ double m_d3Pos[3],
+ m_d3Rot[3],
+ m_d3Scale[3];
+
+
+};
+
+#endif //C_3DOBJECT_HEADER_FILE \ No newline at end of file
diff --git a/MatchBloxEngine/MatchBloxEngine/C_Block.cpp b/MatchBloxEngine/MatchBloxEngine/C_Block.cpp
new file mode 100644
index 0000000..46d7621
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/C_Block.cpp
@@ -0,0 +1,49 @@
+#include <GL\glut.h>
+#include "C_Block.h"
+
+#define FADE_DURATION 500
+
+C_Block::C_Block(char* f_strFileName)
+: C_3DObject(f_strFileName), m_CurrState(IDLE), m_uiAnimStart(0)
+{
+}
+
+
+void C_Block::Draw(unsigned int f_iElapsedTime)
+{
+ unsigned int l_uiDeltaTime = f_iElapsedTime - m_uiAnimStart;
+ double l_Scale = 0.0;
+
+ if (l_uiDeltaTime > g_BlockAnimDurations[(int)m_CurrState])
+ {
+ m_CurrState = IDLE;
+ }
+
+ glPushMatrix();
+ TransRotateScale();
+
+ switch (m_CurrState)
+ {
+ case FADE_IN:
+ l_Scale = (double)l_uiDeltaTime / (double)g_BlockAnimDurations[FADE_IN];
+ glScaled(l_Scale, l_Scale, l_Scale);
+ C_3DObject::Draw();
+ break;
+
+ case FADE_OUT:
+ l_Scale = 1.0 - ((double)l_uiDeltaTime / (double)g_BlockAnimDurations[FADE_OUT]);
+ glScaled(l_Scale, l_Scale, l_Scale);
+ C_3DObject::Draw();
+ break;
+
+ case COLLIDE:
+ break;
+
+ case IDLE:
+ default:
+ C_3DObject::Draw();
+ break;
+ }
+
+ glPopMatrix();
+} \ No newline at end of file
diff --git a/MatchBloxEngine/MatchBloxEngine/C_Block.h b/MatchBloxEngine/MatchBloxEngine/C_Block.h
new file mode 100644
index 0000000..e76a676
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/C_Block.h
@@ -0,0 +1,31 @@
+#ifndef C_BLOCK_HEADER_FILE
+
+#define C_BLOCK_HEADER_FILE
+
+#include "C_3DObject.h"
+
+typedef enum BlockAnimState
+{
+ IDLE = 0,
+ FADE_IN = 1,
+ FADE_OUT = 2,
+ COLLIDE = 3
+};
+
+unsigned int g_BlockAnimDurations[4] = {0, 500, 500, 500};
+
+class C_Block : public C_3DObject
+{
+public:
+ C_Block(char* f_strFileName);
+ ~C_Block();
+
+ void Draw(unsigned int f_iElapsedTime);
+ inline void SetState(BlockAnimState f_State, unsigned int f_uiElapsedTime) { m_CurrState = f_State; m_uiAnimStart = f_uiElapsedTime; }
+
+private:
+ BlockAnimState m_CurrState;
+ unsigned int m_uiAnimStart;
+};
+
+#endif //C_BLOCK_HEADER_FILE \ No newline at end of file
diff --git a/MatchBloxEngine/MatchBloxEngine/C_Hand.cpp b/MatchBloxEngine/MatchBloxEngine/C_Hand.cpp
new file mode 100644
index 0000000..54c1837
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/C_Hand.cpp
@@ -0,0 +1,41 @@
+#include <GL\glut.h>
+#include "C_Hand.h"
+
+#define FADE_DURATION 500
+
+C_Hand::C_Hand(char* f_strFileName)
+: C_3DObject(f_strFileName), m_CurrState(IDLE), m_uiAnimStart(0)
+{
+}
+
+
+void C_Hand::Draw(unsigned int f_iElapsedTime)
+{
+ unsigned int l_uiDeltaTime = f_iElapsedTime - m_uiAnimStart;
+
+ if (l_uiDeltaTime > g_HandAnimDurations[(int)m_CurrState])
+ {
+ m_CurrState = IDLE;
+ }
+
+ glPushMatrix();
+ TransRotateScale();
+
+ switch (m_CurrState)
+ {
+ case GRAB:
+ C_3DObject::Draw();
+ break;
+
+ case RELEASE:
+ C_3DObject::Draw();
+ break;
+
+ case IDLE:
+ default:
+ C_3DObject::Draw();
+ break;
+ }
+
+ glPopMatrix();
+} \ No newline at end of file
diff --git a/MatchBloxEngine/MatchBloxEngine/C_Hand.h b/MatchBloxEngine/MatchBloxEngine/C_Hand.h
new file mode 100644
index 0000000..706cf5f
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/C_Hand.h
@@ -0,0 +1,31 @@
+#ifndef C_HAND_HEADER_FILE
+
+#define C_HAND_HEADER_FILE
+
+#include "C_3DObject.h"
+
+typedef enum HandAnimState
+{
+ IDLE = 0,
+ GRAB = 1,
+ RELEASE = 2,
+// COLLIDE = 3
+};
+
+unsigned int g_HandAnimDurations[3] = {0, 100, 100};
+
+class C_Hand : public C_3DObject
+{
+public:
+ C_Hand(char* f_strFileName);
+ ~C_Hand();
+
+ void Draw(unsigned int f_iElapsedTime);
+ inline void SetState(HandAnimState f_State, unsigned int f_uiElapsedTime) { m_CurrState = f_State; m_uiAnimStart = f_uiElapsedTime; }
+
+private:
+ HandAnimState m_CurrState;
+ unsigned int m_uiAnimStart;
+};
+
+#endif //C_HAND_HEADER_FILE \ No newline at end of file
diff --git a/MatchBloxEngine/MatchBloxEngine/C_Log.cpp b/MatchBloxEngine/MatchBloxEngine/C_Log.cpp
new file mode 100644
index 0000000..d9a1154
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/C_Log.cpp
@@ -0,0 +1,24 @@
+#include "C_Log.h"
+
+C_Log::C_Log(char *f_strFileName)
+{
+}
+
+C_Log::~C_Log()
+{
+}
+
+bool C_Log::LogNewSession(int f_iUserID, int f_iGameID)
+{
+ return true;
+}
+
+bool C_Log::LogSessionTurn(int f_iUserID, int f_iGameID, int f_iBlockNr, int HolePos, unsigned int f_uiTime)
+{
+ return true;
+}
+
+bool C_Log::LogSessionTotals(int f_iUserID, int f_iGameID, unsigned int f_uiTotalTime)
+{
+ return true;
+}
diff --git a/MatchBloxEngine/MatchBloxEngine/C_Log.h b/MatchBloxEngine/MatchBloxEngine/C_Log.h
new file mode 100644
index 0000000..a131cd5
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/C_Log.h
@@ -0,0 +1,19 @@
+#ifndef C_LOG_HEADER_FILE
+
+#define C_LOG_HEADER_FILE
+
+class C_Log
+{
+public:
+ C_Log(char *f_strFileName);
+ ~C_Log();
+
+ bool LogNewSession(int f_iUserID, int f_iGameID);
+ bool LogSessionTurn(int f_iUserID, int f_iGameID, int f_iBlockNr, int HolePos, unsigned int f_uiTime);
+ bool LogSessionTotals(int f_iUserID, int f_iGameID, unsigned int f_uiTotalTime);
+
+private:
+// FILE *m_pLogFile;
+};
+
+#endif //C_LOG_HEADER_FILE \ No newline at end of file
diff --git a/MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp b/MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp
new file mode 100644
index 0000000..ed40038
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.cpp
@@ -0,0 +1,42 @@
+#include "C_MatchBloxEngine.h"
+
+C_MatchBloxEngine::C_MatchBloxEngine(char *f_strModelPath, char *f_strLogFile)
+{
+}
+
+C_MatchBloxEngine::~C_MatchBloxEngine()
+{
+}
+
+GameResult C_MatchBloxEngine::GameStep(msgQueue &f_Queue)
+{
+}
+
+void C_MatchBloxEngine::Draw(unsigned int f_uiElapsedTime)
+{
+}
+
+bool C_MatchBloxEngine::NewGame(int f_iUserID, int f_iGameId)
+{
+ return false;
+}
+
+bool C_MatchBloxEngine::StartGame()
+{
+ return false;
+}
+
+bool C_MatchBloxEngine::Pause()
+{
+ return false;
+}
+
+bool C_MatchBloxEngine::Resume()
+{
+ return false;
+}
+
+bool C_MatchBloxEngine::Abort()
+{
+ return false;
+} \ No newline at end of file
diff --git a/MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.h b/MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.h
new file mode 100644
index 0000000..f733bcc
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/C_MatchBloxEngine.h
@@ -0,0 +1,55 @@
+#ifndef C_MATCHBLOXENGINE_HEADER_FILE
+
+#define C_MATCHBLOXENGINE_HEADER_FILE
+
+#include "MessageQueue.h"
+
+class C_3DObject;
+class C_Block;
+class C_Hand;
+class C_Log;
+
+typedef enum GameResult
+{
+ GR_FINISHED,
+ GR_BUSY,
+ GR_ERROR
+} GameResult;
+
+enum EngineState
+{
+ ES_INITIALISED,
+ ES_ERROR,
+ ES_GET_READY, //game initialised, waiting for start signal from player
+ ES_PLAYING_GRAB_BLOCK, //no block in hand -> grab floating block
+ ES_PLAYING_PUT_BLOCK, //block in hand -> put block in box
+ ES_PAUSED,
+ ES_FINISHED
+};
+
+class C_MatchBloxEngine
+{
+ C_MatchBloxEngine(char *f_strModelPath, char *f_strLogFile);
+ ~C_MatchBloxEngine();
+
+public:
+ GameResult GameStep(msgQueue &f_Queue);
+ void Draw(unsigned int f_uiElapsedTime);
+
+ bool NewGame(int f_iUserID, int f_iGameId);
+ bool StartGame();
+ bool Pause();
+ bool Resume();
+ bool Abort();
+
+private:
+ C_Block *m_pBlock[4];
+ C_Hand *m_pHand;
+ C_3DObject *m_pHole[4],
+ *m_pBox;
+ C_Log *m_pLog;
+
+ EngineState m_State;
+};
+
+#endif //C_MATCHBLOXENGINE_HEADER_FILE \ No newline at end of file
diff --git a/MatchBloxEngine/MatchBloxEngine/MatchBloxEngine.vcproj b/MatchBloxEngine/MatchBloxEngine/MatchBloxEngine.vcproj
new file mode 100644
index 0000000..5bfdb0b
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/MatchBloxEngine.vcproj
@@ -0,0 +1,249 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8,00"
+ Name="MatchBloxEngine"
+ ProjectGUID="{76B80F87-6EFD-4439-9D32-86FA7BD83035}"
+ RootNamespace="MatchBloxEngine"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="..\..\headtrack_stereo_demo\include"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="glut32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="..\..\headtrack_stereo_demo\lib\win32\"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="copy ..\..\headtrack_stereo_demo\lib\win32\glut32.dll &quot;$(OutDir)&quot;"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="..\..\headtrack_stereo_demo\include"
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+ RuntimeLibrary="2"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ Detect64BitPortabilityProblems="true"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="glut32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\..\headtrack_stereo_demo\lib\win32\"
+ GenerateDebugInformation="true"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="copy ..\..\headtrack_stereo_demo\lib\win32\glut32.dll &quot;$(OutDir)&quot;"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath=".\C_3DObject.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\C_Block.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\C_Hand.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\C_Log.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\C_MatchBloxEngine.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\main.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath=".\C_3DObject.h"
+ >
+ </File>
+ <File
+ RelativePath=".\C_Block.h"
+ >
+ </File>
+ <File
+ RelativePath=".\C_Hand.h"
+ >
+ </File>
+ <File
+ RelativePath=".\C_Log.h"
+ >
+ </File>
+ <File
+ RelativePath=".\C_MatchBloxEngine.h"
+ >
+ </File>
+ <File
+ RelativePath=".\MessageQueue.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/MatchBloxEngine/MatchBloxEngine/MessageQueue.h b/MatchBloxEngine/MatchBloxEngine/MessageQueue.h
new file mode 100644
index 0000000..0edc388
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/MessageQueue.h
@@ -0,0 +1,19 @@
+#include <queue>
+
+typedef enum msgType
+{
+ MOUSE_MOVE,
+ MOUSE_PRESS,
+ KEY_PRESS,
+ SPECIAL_KEY,
+ WII_CURSOR_MOVE,
+ WII_BUTTON_PRESS
+};
+
+typedef struct message
+{
+ msgType m_MessageType;
+ int parm1, parm2, parm3, parm4;
+} msgStruct;
+
+typedef std::queue<msgStruct> msgQueue;
diff --git a/MatchBloxEngine/MatchBloxEngine/main.cpp b/MatchBloxEngine/MatchBloxEngine/main.cpp
new file mode 100644
index 0000000..df9e82d
--- /dev/null
+++ b/MatchBloxEngine/MatchBloxEngine/main.cpp
@@ -0,0 +1,129 @@
+#include <GL/glut.h>
+#include <stdlib.h>
+
+
+#include "MessageQueue.h"
+
+#define SCREEN_WIDTH 640
+#define SCREEN_HEIGHT 480
+
+msgQueue g_Queue;
+
+void init_gl(void)
+{
+ glClearColor(0.2, 1, 0.2, 1);
+ glClearDepth(1000.0);
+} // init_gl
+
+void idle_func(void)
+{
+ //call engine idle func
+
+ glutPostRedisplay();
+}
+
+void render_scene(void)
+{
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+
+ glutSwapBuffers();
+
+} // render_scene
+
+
+
+void process_normal_keys(unsigned char key, int x, int y)
+{
+ // escape
+ if (key == 27)
+ {
+ exit(0);
+ }
+ else
+ {
+ msgStruct l_msg;
+ l_msg.m_MessageType = KEY_PRESS;
+ l_msg.parm1 = key;
+ l_msg.parm2 = x;
+ l_msg.parm3 = y;
+
+ g_Queue.push(l_msg);
+ }
+} // process_normal_keys
+
+
+
+void process_special_keys(int key, int x, int y)
+{
+ switch (key)
+ {
+ // do sumting
+ }
+ msgStruct l_msg;
+ l_msg.m_MessageType = SPECIAL_KEY;
+ l_msg.parm1 = key;
+ l_msg.parm2 = x;
+ l_msg.parm3 = y;
+
+ g_Queue.push(l_msg);
+
+} // process_special_keys
+
+
+
+void process_mouse(int button, int state, int x, int y)
+{
+ msgStruct l_msg;
+ l_msg.m_MessageType = MOUSE_PRESS;
+ l_msg.parm1 = button;
+ l_msg.parm2 = state;
+ l_msg.parm3 = x;
+ l_msg.parm4 = y;
+
+ g_Queue.push(l_msg);
+
+
+} // process_mouse
+
+
+
+void process_passive_mouse(int x, int y)
+{
+ //process_mouse(-1, -1, x, y);
+ msgStruct l_msg;
+ l_msg.m_MessageType = MOUSE_MOVE;
+ l_msg.parm1 = x;
+ l_msg.parm2 = y;
+ l_msg.parm3 = 0;
+ l_msg.parm4 = 0;
+
+ g_Queue.push(l_msg);
+
+} // process_passive_mouse
+
+
+
+int main(int argc, char **argv)
+{
+ glutInit(&argc, argv);
+ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
+ glutInitWindowSize(SCREEN_WIDTH, SCREEN_HEIGHT);
+ glutCreateWindow("Menu demo");
+ glutDisplayFunc(render_scene);
+ glutIdleFunc(render_scene);
+ glutKeyboardFunc(process_normal_keys);
+ glutSpecialFunc(process_special_keys);
+ glutMouseFunc(process_mouse);
+ glutPassiveMotionFunc(process_passive_mouse);
+
+ init_gl();
+ //MenuInit(SCREEN_WIDTH, SCREEN_HEIGHT);
+
+ glutMainLoop();
+
+ return 0;
+
+} // main
+
+