| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- #ifndef SPRITESAMPLE_H_
- #define SPRITESAMPLE_H_
- #include "gameplay.h"
- #include "Sample.h"
- using namespace gameplay;
- /**
- * Sample drawing sprites in a scene with the Sprite class.
- */
- class SpriteSample : public Sample
- {
- public:
-
- enum Movement
- {
- WALK_FORWARD = (1 << 0),
- WALK_BACKWARD = (1 << 1),
- };
- SpriteSample();
- void keyEvent(Keyboard::KeyEvent evt, int key);
-
- void touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
- protected:
- void initialize();
- void finalize();
- void update(float elapsedTime);
- void render(float elapsedTime);
- private:
-
- bool drawScene(Node* node);
-
- float getTime() const;
- Font* _font;
- Scene* _scene;
- Node* _cameraNode;
- TileSet* _floorTileSet;
- Node* _floorNode;
- Sprite* _backgroundSprite;
- Node* _backgroundNode;
- Sprite* _playerSprite;
- Node* _playerNode;
- Animation* _playerAnimation;
- int _playerMovement;
- Sprite* _rocketSprite;
- Node* _rocketNode;
- Sprite* _waterSprite;
- Node* _waterNode;
- Text* _text;
- Node* _textNode;
-
- };
- #endif
|