SpriteSample.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef SPRITESAMPLE_H_
  2. #define SPRITESAMPLE_H_
  3. #include "gameplay.h"
  4. #include "Sample.h"
  5. using namespace gameplay;
  6. /**
  7. * Sample drawing sprites in a scene with the Sprite class.
  8. */
  9. class SpriteSample : public Sample
  10. {
  11. public:
  12. enum Movement
  13. {
  14. WALK_FORWARD = (1 << 0),
  15. WALK_BACKWARD = (1 << 1),
  16. };
  17. SpriteSample();
  18. void keyEvent(Keyboard::KeyEvent evt, int key);
  19. void touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
  20. protected:
  21. void initialize();
  22. void finalize();
  23. void update(float elapsedTime);
  24. void render(float elapsedTime);
  25. private:
  26. bool drawScene(Node* node);
  27. float getTime() const;
  28. Font* _font;
  29. Scene* _scene;
  30. Node* _cameraNode;
  31. TileSet* _floorTileSet;
  32. Node* _floorNode;
  33. Sprite* _backgroundSprite;
  34. Node* _backgroundNode;
  35. Sprite* _playerSprite;
  36. Node* _playerNode;
  37. Animation* _playerAnimation;
  38. int _playerMovement;
  39. Sprite* _rocketSprite;
  40. Node* _rocketNode;
  41. Sprite* _waterSprite;
  42. Node* _waterNode;
  43. Text* _text;
  44. Node* _textNode;
  45. };
  46. #endif