source: proiecte/SIMEO/Simeo/src/SimeoEngine/GlutDemoApplication.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: 1.5 KB
Line 
1
2
3#include "GlutDemoApplication.h"
4
5#include "GlutStuff.h"
6
7#include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
8#include "BulletDynamics/Dynamics/btRigidBody.h"
9
10void    GlutDemoApplication::updateModifierKeys()
11{
12        m_modifierKeys = 0;
13        if (glutGetModifiers() & GLUT_ACTIVE_ALT)
14                m_modifierKeys |= BT_ACTIVE_ALT;
15
16        if (glutGetModifiers() & GLUT_ACTIVE_CTRL)
17                m_modifierKeys |= BT_ACTIVE_CTRL;
18
19        if (glutGetModifiers() & GLUT_ACTIVE_SHIFT)
20                m_modifierKeys |= BT_ACTIVE_SHIFT;
21}
22
23void GlutDemoApplication::specialKeyboard(int key, int x, int y)
24{
25        (void)x;
26        (void)y;
27
28        switch (key)
29        {
30        case GLUT_KEY_F1:
31                {
32
33                        break;
34                }
35
36        case GLUT_KEY_F2:
37                {
38
39                        break;
40                }
41
42
43        case GLUT_KEY_END:
44                {
45                        int numObj = getDynamicsWorld()->getNumCollisionObjects();
46                        if (numObj)
47                        {
48                                btCollisionObject* obj = getDynamicsWorld()->getCollisionObjectArray()[numObj-1];
49
50                                getDynamicsWorld()->removeCollisionObject(obj);
51                                btRigidBody* body = btRigidBody::upcast(obj);
52                                if (body && body->getMotionState())
53                                {
54                                        delete body->getMotionState();
55                                }
56                                delete obj;
57
58
59                        }
60                        break;
61                }
62        case GLUT_KEY_LEFT : stepLeft(); break;
63        case GLUT_KEY_RIGHT : stepRight(); break;
64        case GLUT_KEY_UP : stepFront(); break;
65        case GLUT_KEY_DOWN : stepBack(); break;
66        case GLUT_KEY_PAGE_UP : zoomIn(); break;
67        case GLUT_KEY_PAGE_DOWN : zoomOut(); break;
68        case GLUT_KEY_HOME : toggleIdle(); break;
69        default:
70                //        std::cout << "unused (special) key : " << key << std::endl;
71                break;
72        }
73
74        glutPostRedisplay();
75
76}
77
78void GlutDemoApplication::swapBuffers()
79{
80        glutSwapBuffers();
81
82}
83
84
85
Note: See TracBrowser for help on using the repository browser.