ParticlesGame.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. #ifndef PARTICLESGAME_H_
  2. #define PARTICLESGAME_H_
  3. #include "gameplay.h"
  4. using namespace gameplay;
  5. /**
  6. * Main game class.
  7. */
  8. class ParticlesGame: public Game, Control::Listener
  9. {
  10. public:
  11. /**
  12. * Constructor.
  13. */
  14. ParticlesGame();
  15. /**
  16. * @see Game::touchEvent
  17. */
  18. void touchEvent(Touch::TouchEvent evt, int x, int y, unsigned int contactIndex);
  19. /**
  20. * @see Game::mouseEvent
  21. */
  22. bool mouseEvent(Mouse::MouseEvent evt, int x, int y, int wheelDelta);
  23. /**
  24. * @see Game::keyEvent
  25. */
  26. void keyEvent(Keyboard::KeyEvent evt, int key);
  27. /**
  28. * @see Game::resizeEvent
  29. */
  30. void resizeEvent(unsigned int width, unsigned int height);
  31. /**
  32. * @see Control::controlEvent
  33. */
  34. void controlEvent(Control* control, EventType evt);
  35. protected:
  36. /**
  37. * @see Game::initialize
  38. */
  39. void initialize();
  40. /**
  41. * @see Game::finalize
  42. */
  43. void finalize();
  44. /**
  45. * @see Game::update
  46. */
  47. void update(float elapsedTime);
  48. /**
  49. * @see Game::render
  50. */
  51. void render(float elapsedTime);
  52. private:
  53. bool drawScene(Node* node, void* cookie);
  54. void drawSplash(void* param);
  55. void loadEmitters();
  56. void emitterChanged();
  57. void drawFrameRate(Font* font, const Vector4& color, unsigned int x, unsigned int y, unsigned int fps);
  58. void updateTexture();
  59. void updateImageControl();
  60. void updateFrames();
  61. void addGrid(unsigned int lineCount);
  62. void saveFile();
  63. std::string toString(bool b);
  64. std::string toString(int i);
  65. std::string toString(unsigned int i);
  66. std::string toString(const Vector3& v);
  67. std::string toString(const Vector4& v);
  68. std::string toString(const Quaternion& q);
  69. std::string toString(ParticleEmitter::TextureBlending blending);
  70. Scene* _scene;
  71. Node* _particleEmitterNode;
  72. Node* _cameraParent;
  73. Form* _form;
  74. bool _wDown, _sDown, _aDown, _dDown;
  75. bool _touched;
  76. int _prevX, _prevY;
  77. ParticleEmitter* _particleEmitter;
  78. std::string _url;
  79. Font* _font;
  80. Slider* _startRed;
  81. Slider* _startGreen;
  82. Slider* _startBlue;
  83. Slider* _startAlpha;
  84. Slider* _endRed;
  85. Slider* _endGreen;
  86. Slider* _endBlue;
  87. Slider* _endAlpha;
  88. Slider* _startMin;
  89. Slider* _startMax;
  90. Slider* _endMin;
  91. Slider* _endMax;
  92. Slider* _energyMin;
  93. Slider* _energyMax;
  94. Slider* _emissionRate;
  95. Slider* _posVarX;
  96. Slider* _posVarY;
  97. Slider* _posVarZ;
  98. Slider* _velX;
  99. Slider* _velY;
  100. Slider* _velZ;
  101. Slider* _velVarX;
  102. Slider* _velVarY;
  103. Slider* _velVarZ;
  104. Slider* _accelX;
  105. Slider* _accelY;
  106. Slider* _accelZ;
  107. Slider* _accelVarX;
  108. Slider* _accelVarY;
  109. Slider* _accelVarZ;
  110. Slider* _spinSpeedMin;
  111. Slider* _spinSpeedMax;
  112. Slider* _axisX;
  113. Slider* _axisY;
  114. Slider* _axisZ;
  115. Slider* _axisVarX;
  116. Slider* _axisVarY;
  117. Slider* _axisVarZ;
  118. Slider* _rotationSpeedMin;
  119. Slider* _rotationSpeedMax;
  120. CheckBox* _started;
  121. Button* _reset;
  122. Button* _emit;
  123. Button* _zoomIn;
  124. Button* _zoomOut;
  125. Button* _save;
  126. Button* _load;
  127. Slider* _burstSize;
  128. Container* _position;
  129. Container* _particleProperties;
  130. CheckBox* _vsync;
  131. bool _panning;
  132. bool _rotating;
  133. bool _zooming;
  134. };
  135. #endif