From 338ea2bc749adf8a5183804acec0f37ee4d69222 Mon Sep 17 00:00:00 2001 From: Oliver Schinagl Date: Wed, 14 May 2008 12:55:30 +0000 Subject: Menu and engine integrated. OpenGL init/blending needs to be fixed. --- matchblox/Makefile | 2 +- matchblox/main.cpp | 19 ++++++++++--------- 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 + +#include #include #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 -- cgit v0.12