source: proiecte/SIMEO/Simeo/src/SimeoEngine/GlutStuff.cpp @ 167

Last change on this file since 167 was 167, checked in by (none), 14 years ago

Simeo: added final project and also older proof of concept code.

We used Git for version control, so look at the Git repo
in SIMEO/Simeo/ for more info.

File size: 2.8 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16
17#include "LocalGui.h"
18
19//glut is C code, this global gLocalGui links glut to the C++ demo
20static LocalGui *gLocalGui = NULL;
21
22
23#include "GlutStuff.h"
24
25static void glutKeyboardCallback(unsigned char key, int x, int y)
26{
27        gLocalGui->keyboardCallback(key,x,y);
28}
29
30static void glutKeyboardUpCallback(unsigned char key, int x, int y)
31{
32  gLocalGui->keyboardUpCallback(key,x,y);
33}
34
35static void glutSpecialKeyboardCallback(int key, int x, int y)
36{
37        gLocalGui->specialKeyboard(key,x,y);
38}
39
40static void glutSpecialKeyboardUpCallback(int key, int x, int y)
41{
42        gLocalGui->specialKeyboardUp(key,x,y);
43}
44
45static void glutMouseFuncCallback(int button, int state, int x, int y)
46{
47        gLocalGui->mouseFunc(button,state,x,y);
48}
49
50static void glutMotionFuncCallback(int x,int y)
51{
52        gLocalGui->mouseMotionFunc(x,y);
53}
54
55static void glutReshapeCallback(int w, int h)
56{
57        gLocalGui->reshape(w,h);
58}
59
60static void glutMoveAndDisplayCallback()
61{
62        gLocalGui->moveAndDisplay();
63}
64
65static void glutDisplayCallback(void)
66{
67        gLocalGui->displayCallback();
68}
69
70int glutmain(int argc, char **argv, Environment *env)
71{
72        int width = 1024;
73        int height = 768;
74        const char *title = "Simeo Engine";
75
76        glutInit(&argc, argv);
77
78        glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH | GLUT_STENCIL);
79        glutInitWindowPosition(0, 0);
80        glutInitWindowSize(width, height);
81        glutCreateWindow(title);
82
83#ifdef BT_USE_FREEGLUT
84        glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS);
85#endif
86
87        gLocalGui = new LocalGui(env);
88        gLocalGui->init();
89
90        glutKeyboardFunc(glutKeyboardCallback);
91        glutKeyboardUpFunc(glutKeyboardUpCallback);
92        glutSpecialFunc(glutSpecialKeyboardCallback);
93        glutSpecialUpFunc(glutSpecialKeyboardUpCallback);
94        glutReshapeFunc(glutReshapeCallback);
95        glutIdleFunc(glutMoveAndDisplayCallback);
96        glutMouseFunc(glutMouseFuncCallback);
97        glutMotionFunc(glutMotionFuncCallback);
98        glutDisplayFunc( glutDisplayCallback );
99
100        glutMoveAndDisplayCallback();
101
102        glutMainLoop();
103
104        return 0;
105}
106
107
Note: See TracBrowser for help on using the repository browser.