* correct for real the Makefile
[hkl3d.git] / test / gui / OpenGL / GlutDemoApplication.cpp
blob2c9597e61f094898a632593b1def7d39cbd3292a
2 #ifndef _WINDOWS
4 #include "GlutDemoApplication.h"
6 #include "GlutStuff.h"
8 #include "BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h"
9 #include "BulletDynamics/Dynamics/btRigidBody.h"
11 void GlutDemoApplication::updateModifierKeys()
13 m_modifierKeys = 0;
14 if (glutGetModifiers() & GLUT_ACTIVE_ALT)
15 m_modifierKeys |= BT_ACTIVE_ALT;
17 if (glutGetModifiers() & GLUT_ACTIVE_CTRL)
18 m_modifierKeys |= BT_ACTIVE_CTRL;
20 if (glutGetModifiers() & GLUT_ACTIVE_SHIFT)
21 m_modifierKeys |= BT_ACTIVE_SHIFT;
24 void GlutDemoApplication::specialKeyboard(int key, int x, int y)
26 (void)x;
27 (void)y;
29 switch (key)
31 case GLUT_KEY_F1:
34 break;
37 case GLUT_KEY_F2:
40 break;
44 case GLUT_KEY_END:
46 int numObj = getDynamicsWorld()->getNumCollisionObjects();
47 if (numObj)
49 btCollisionObject* obj = getDynamicsWorld()->getCollisionObjectArray()[numObj-1];
51 getDynamicsWorld()->removeCollisionObject(obj);
52 btRigidBody* body = btRigidBody::upcast(obj);
53 if (body && body->getMotionState())
55 delete body->getMotionState();
57 delete obj;
61 break;
63 case GLUT_KEY_LEFT : stepLeft(); break;
64 case GLUT_KEY_RIGHT : stepRight(); break;
65 case GLUT_KEY_UP : stepFront(); break;
66 case GLUT_KEY_DOWN : stepBack(); break;
67 case GLUT_KEY_PAGE_UP : zoomIn(); break;
68 case GLUT_KEY_PAGE_DOWN : zoomOut(); break;
69 case GLUT_KEY_HOME : toggleIdle(); break;
70 default:
71 //std::cout << "unused (special) key : " << key << std::endl;
72 break;
75 glutPostRedisplay();
79 void GlutDemoApplication::swapBuffers()
81 glutSwapBuffers();
85 #endif //_WINDOWS