BillboardSample.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef BILLBOARDSAMPLE_H_
  2. #define BILLBOARDSAMPLE_H_
  3. #include "gameplay.h"
  4. #include "Sample.h"
  5. #include "FirstPersonCamera.h"
  6. using namespace gameplay;
  7. /**
  8. * Sample for 3D billboarding with cloud sprites
  9. */
  10. class BillboardSample: public Sample
  11. {
  12. public:
  13. BillboardSample();
  14. void touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
  15. void keyEvent(Keyboard::KeyEvent evt, int key);
  16. bool mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
  17. void gamepadEvent(Gamepad::GamepadEvent evt, Gamepad* gamepad);
  18. protected:
  19. void initialize();
  20. void finalize();
  21. void update(float elapsedTime);
  22. void render(float elapsedTime);
  23. private:
  24. void loadGround();
  25. void loadBillboards();
  26. bool drawScene(Node* node);
  27. private:
  28. FirstPersonCamera _camera;
  29. std::vector<Node*> _billboards;
  30. Font* _font;
  31. Scene* _scene;
  32. Model* _ground;
  33. Gamepad* _gamepad;
  34. unsigned int _moveFlags;
  35. int _prevX;
  36. int _prevY;
  37. bool _buttonPressed;
  38. };
  39. #endif