[21] | 1 | /* |
---|
| 2 | SimpleScenes_BoxStack.h |
---|
| 3 | ---------------------- |
---|
| 4 | A reimplementation of the ODE box stacking (actually loads of different |
---|
| 5 | objects) demo using Ogre and the OgreOde wrapper. |
---|
| 6 | */ |
---|
| 7 | #ifndef _SIMPLESCENES_BOXSTACK_H_ |
---|
| 8 | #define _SIMPLESCENES_BOXSTACK_H_ |
---|
| 9 | |
---|
| 10 | /* |
---|
| 11 | The box stacking test extends the base test class |
---|
| 12 | */ |
---|
| 13 | class SimpleScenes_BoxStack:public SimpleScenes |
---|
| 14 | { |
---|
| 15 | public: |
---|
| 16 | // Standard constructor/destructor |
---|
| 17 | SimpleScenes_BoxStack(OgreOde::World *world) : SimpleScenes(world) {} |
---|
| 18 | virtual ~SimpleScenes_BoxStack(){} |
---|
| 19 | |
---|
| 20 | // Return our name for the test application to display |
---|
| 21 | virtual const String& getName() |
---|
| 22 | { |
---|
| 23 | static String name = "Test Box Stack"; |
---|
| 24 | return name; |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | // Return a description of the keys that the user can use in this test |
---|
| 28 | virtual const String& getKeys() |
---|
| 29 | { |
---|
| 30 | static String keys = "Z - Sphere, X - Box, C - Capsule, G - Ragdoll, T - Trimesh"; |
---|
| 31 | return keys; |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | #if (OGRE_VERSION_MINOR < 4) |
---|
| 35 | // Handle the user's key presses |
---|
| 36 | virtual void frameEnded(Real time,InputReader* input) |
---|
| 37 | { |
---|
| 38 | // Do default key handling |
---|
| 39 | SimpleScenes::frameEnded(time,input); |
---|
| 40 | #else |
---|
| 41 | |
---|
| 42 | virtual void frameEnded(Real time, OIS::Keyboard* input, OIS::Mouse* mouse) |
---|
| 43 | { |
---|
| 44 | // Do default processing |
---|
| 45 | SimpleScenes::frameEnded(time, input, mouse); |
---|
| 46 | #endif |
---|
| 47 | OgreOde::Body* body = 0; |
---|
| 48 | |
---|
| 49 | // Create random objects, that method will stop them being created too often |
---|
| 50 | if (input->isKeyDown(KC_Z)) |
---|
| 51 | body = createRandomObject(OgreOde::Geometry::Class_Sphere); |
---|
| 52 | else if (input->isKeyDown(KC_X)) |
---|
| 53 | body = createRandomObject(OgreOde::Geometry::Class_Box); |
---|
| 54 | else if (input->isKeyDown(KC_C)) |
---|
| 55 | body = createRandomObject(OgreOde::Geometry::Class_Capsule); |
---|
| 56 | else if (input->isKeyDown(KC_T)) |
---|
| 57 | body = createRandomObject(OgreOde::Geometry::Class_TriangleMesh); |
---|
| 58 | else if (input->isKeyDown(KC_G)) |
---|
| 59 | createRagDoll(); |
---|
| 60 | |
---|
| 61 | } |
---|
| 62 | }; |
---|
| 63 | |
---|
| 64 | #endif |
---|