TerrainSample.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #ifndef TERRAINSAMPLE_H_
  2. #define TERRAINSAMPLE_H_
  3. #include "gameplay.h"
  4. #include "Sample.h"
  5. using namespace gameplay;
  6. class TerrainSample : public Sample, public Control::Listener
  7. {
  8. public:
  9. TerrainSample();
  10. ~TerrainSample();
  11. void keyEvent(Keyboard::KeyEvent evt, int key);
  12. void touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
  13. bool mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
  14. void controlEvent(Control* control, EventType evt);
  15. protected:
  16. void initialize();
  17. bool intializeLights(Node* node);
  18. void finalize();
  19. void update(float elapsedTime);
  20. void render(float elapsedTime);
  21. bool drawScene(Node* node);
  22. void setMessage(const char* message);
  23. private:
  24. enum Mode
  25. {
  26. MODE_LOOK,
  27. MODE_DROP_SPHERE,
  28. MODE_DROP_BOX
  29. };
  30. Font* _font;
  31. Scene* _scene;
  32. Terrain* _terrain;
  33. Node* _sky;
  34. Form* _form;
  35. bool _formVisible;
  36. Vector2 _formSize;
  37. bool _wireframe;
  38. bool _debugPhysics;
  39. bool _snapToGround;
  40. bool _vsync;
  41. Mode _mode;
  42. Node* _sphere;
  43. Node* _box;
  44. std::list<Node*> _shapes;
  45. Light* _directionalLight;
  46. };
  47. #endif