summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Schinagl <oliver@schinagl.nl>2008-05-14 12:45:18 (GMT)
committerOliver Schinagl <oliver@schinagl.nl>2008-05-14 12:45:18 (GMT)
commitc00a15aa99bd0a32d4c4faa3f42698a8485fdb72 (patch)
treecb8376a2b3d932e8738897e513cb633027d08dce
parentd46ec98f6dc5156c98a37b1c4232f56bc0583a22 (diff)
download2iv55-c00a15aa99bd0a32d4c4faa3f42698a8485fdb72.zip
2iv55-c00a15aa99bd0a32d4c4faa3f42698a8485fdb72.tar.gz
2iv55-c00a15aa99bd0a32d4c4faa3f42698a8485fdb72.tar.bz2
first integration step.
-rw-r--r--matchblox/Makefile4
-rw-r--r--matchblox/main.cpp67
2 files changed, 29 insertions, 42 deletions
diff --git a/matchblox/Makefile b/matchblox/Makefile
index 0222105..5522125 100644
--- a/matchblox/Makefile
+++ b/matchblox/Makefile
@@ -6,11 +6,11 @@ CC=gcc
all: matchblox_menu matchblox_engine
- $(CXX) $(LDFLAGS) main.o bitmap.o button.o font.o menu.o C_3DObject.o C_Hand.o C_Block.o C_Log.o C_Environment.o C_Box.o C_MatchBloxEngine.o -o MatchBlox
+ $(CXX) $(LDFLAGS) main.o message_queue.o bitmap.o button.o font.o menu.o C_3DObject.o C_Hand.o C_Block.o C_Log.o C_Environment.o C_Box.o C_MatchBloxEngine.o -o MatchBlox
matchblox_common:
- $(CC) $(CFLAGS) -o message_queue -c common/message_queue.c
+ $(CC) $(CFLAGS) -o message_queue.o -c common/message_queue.c
$(CC) $(CFLAGS) -o bitmap.o -c common/bitmap.c
$(CC) $(CFLAGS) -o font.o -c common/font.c
diff --git a/matchblox/main.cpp b/matchblox/main.cpp
index dc4ec64..06cbca6 100644
--- a/matchblox/main.cpp
+++ b/matchblox/main.cpp
@@ -1,13 +1,24 @@
-#include <GL/glut.h>
+#ifdef G_OS_WIN32
+ #define WIN32_LEAN_AND_MEAN 1
+ #include <windows.h>
+#else
+ #define FALSE 0
+ #define TRUE !FALSE
+#endif
+
#include <iostream>
+#include <GL/glut.h>
+
+#include "message_queue.h"
-#include "MessageQueue.h"
#include "C_MatchBloxEngine.h"
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
-msgQueue g_Queue;
+#define KEY_ESCAPE 27
+
+
C_MatchBloxEngine *g_pEngine;
void init_gl(void)
@@ -56,25 +67,19 @@ void reshape(int w, int h)
void process_normal_keys(unsigned char key, int x, int y)
{
- // escape
- if (key == 27)
- {
- exit(0);
- }
- else
+
+ switch (key)
{
- if (key == 'n')
- {
+ case KEY_ESCAPE:
+ exit(0);
+ break;
+ case 'n':
g_pEngine->Abort();
g_pEngine->NewGame(0, 0, BS_LARGE);
- }
- 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);
+ break;
+ case ' ':
+
+ break;
}
} // process_normal_keys
@@ -86,13 +91,7 @@ void process_special_keys(int key, int x, int y)
{
// 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
@@ -100,14 +99,7 @@ void process_special_keys(int key, int x, int y)
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
@@ -117,14 +109,7 @@ void process_mouse(int button, int state, int x, int y)
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
@@ -132,10 +117,12 @@ void process_passive_mouse(int x, int y)
int main(int argc, char **argv)
{
+ messageq_init();
+
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(SCREEN_WIDTH, SCREEN_HEIGHT);
- glutCreateWindow("MatchBloxEngine demo");
+ glutCreateWindow("MatchBlox");
glutReshapeFunc(reshape);
glutDisplayFunc(render_scene);