diff options
author | Oliver Schinagl <oliver@schinagl.nl> | 2008-05-14 12:55:30 (GMT) |
---|---|---|
committer | Oliver Schinagl <oliver@schinagl.nl> | 2008-05-14 12:55:30 (GMT) |
commit | 338ea2bc749adf8a5183804acec0f37ee4d69222 (patch) | |
tree | 27463be7a35d66aaec43a23204de8a17a29ba1d5 | |
parent | c00a15aa99bd0a32d4c4faa3f42698a8485fdb72 (diff) | |
download | 2iv55-338ea2bc749adf8a5183804acec0f37ee4d69222.zip 2iv55-338ea2bc749adf8a5183804acec0f37ee4d69222.tar.gz 2iv55-338ea2bc749adf8a5183804acec0f37ee4d69222.tar.bz2 |
Menu and engine integrated. OpenGL init/blending needs to be fixed.
-rw-r--r-- | matchblox/Makefile | 2 | ||||
-rw-r--r-- | matchblox/main.cpp | 19 | ||||
-rw-r--r-- | matchblox/menu/menu.h | 12 |
3 files changed, 22 insertions, 11 deletions
diff --git a/matchblox/Makefile b/matchblox/Makefile index 5522125..cd11b63 100644 --- a/matchblox/Makefile +++ b/matchblox/Makefile @@ -1,6 +1,6 @@ CFLAGS=-Icommon -Imenu -Iengine -O2 CXXFLAGS=$(CFLAGS) -LDFLAGS=-lglut +LDFLAGS=-lglut -lm CXX=g++ CC=gcc diff --git a/matchblox/main.cpp b/matchblox/main.cpp index 06cbca6..409a3ea 100644 --- a/matchblox/main.cpp +++ b/matchblox/main.cpp @@ -7,9 +7,12 @@ #endif
#include <iostream>
+
+#include <math.h>
#include <GL/glut.h>
#include "message_queue.h"
+#include "menu.h"
#include "C_MatchBloxEngine.h"
@@ -46,9 +49,11 @@ void idle_func(void) void render_scene(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
+
g_pEngine->Render(glutGet(GLUT_ELAPSED_TIME));
+ MenuRender();
+
glutSwapBuffers();
} // render_scene
@@ -78,7 +83,7 @@ void process_normal_keys(unsigned char key, int x, int y) g_pEngine->NewGame(0, 0, BS_LARGE);
break;
case ' ':
-
+ MenuNext();
break;
}
} // process_normal_keys
@@ -99,18 +104,14 @@ void process_special_keys(int key, int x, int y) void process_mouse(int button, int state, int x, int y)
{
-
-
-
+ MenuMouseClick(button, state, x, y);
} // process_mouse
void process_passive_mouse(int x, int y)
{
- //process_mouse(-1, -1, x, y);
-
-
+ MenuMouseMove(x, y);
} // process_passive_mouse
@@ -133,7 +134,7 @@ int main(int argc, char **argv) glutPassiveMotionFunc(process_passive_mouse);
init_gl();
- //MenuInit(SCREEN_WIDTH, SCREEN_HEIGHT);
+ MenuInit(SCREEN_WIDTH, SCREEN_HEIGHT);
g_pEngine = new C_MatchBloxEngine("models", "");
diff --git a/matchblox/menu/menu.h b/matchblox/menu/menu.h index 0b4e95f..b5e1d9f 100644 --- a/matchblox/menu/menu.h +++ b/matchblox/menu/menu.h @@ -1,10 +1,20 @@ #ifndef _CMENU_H
#define _CMENU_H
+ +#ifdef __cplusplus +extern "C" { +#endif + void MenuNext(void);
void MenuInit(int f_iWinWidth, int f_iWinHeight);
void MenuRender(void);
void MenuMouseClick(int button, int state, int x, int y);
-void MenuMouseMove(int x, int y);
+void MenuMouseMove(int x, int y); + +
+#ifdef __cplusplus +} +#endif #endif
|