1 | /* |
---|
2 | Bullet Continuous Collision Detection and Physics Library |
---|
3 | Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ |
---|
4 | |
---|
5 | This software is provided 'as-is', without any express or implied warranty. |
---|
6 | In no event will the authors be held liable for any damages arising from the use of this software. |
---|
7 | Permission is granted to anyone to use this software for any purpose, |
---|
8 | including commercial applications, and to alter it and redistribute it freely, |
---|
9 | subject to the following restrictions: |
---|
10 | |
---|
11 | 1. 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. |
---|
12 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. |
---|
13 | 3. 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 |
---|
20 | static LocalGui *gLocalGui = NULL; |
---|
21 | |
---|
22 | |
---|
23 | #include "GlutStuff.h" |
---|
24 | |
---|
25 | static void glutKeyboardCallback(unsigned char key, int x, int y) |
---|
26 | { |
---|
27 | gLocalGui->keyboardCallback(key,x,y); |
---|
28 | } |
---|
29 | |
---|
30 | static void glutKeyboardUpCallback(unsigned char key, int x, int y) |
---|
31 | { |
---|
32 | gLocalGui->keyboardUpCallback(key,x,y); |
---|
33 | } |
---|
34 | |
---|
35 | static void glutSpecialKeyboardCallback(int key, int x, int y) |
---|
36 | { |
---|
37 | gLocalGui->specialKeyboard(key,x,y); |
---|
38 | } |
---|
39 | |
---|
40 | static void glutSpecialKeyboardUpCallback(int key, int x, int y) |
---|
41 | { |
---|
42 | gLocalGui->specialKeyboardUp(key,x,y); |
---|
43 | } |
---|
44 | |
---|
45 | static void glutMouseFuncCallback(int button, int state, int x, int y) |
---|
46 | { |
---|
47 | gLocalGui->mouseFunc(button,state,x,y); |
---|
48 | } |
---|
49 | |
---|
50 | static void glutMotionFuncCallback(int x,int y) |
---|
51 | { |
---|
52 | gLocalGui->mouseMotionFunc(x,y); |
---|
53 | } |
---|
54 | |
---|
55 | static void glutReshapeCallback(int w, int h) |
---|
56 | { |
---|
57 | gLocalGui->reshape(w,h); |
---|
58 | } |
---|
59 | |
---|
60 | static void glutMoveAndDisplayCallback() |
---|
61 | { |
---|
62 | gLocalGui->moveAndDisplay(); |
---|
63 | } |
---|
64 | |
---|
65 | static void glutDisplayCallback(void) |
---|
66 | { |
---|
67 | gLocalGui->displayCallback(); |
---|
68 | } |
---|
69 | |
---|
70 | int 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 | |
---|