ParticlesSample.h 3.3 KB

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