CCParticleExamples.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. /****************************************************************************
  2. Copyright (c) 2008-2010 Ricardo Quesada
  3. Copyright (c) 2010-2012 cocos2d-x.org
  4. Copyright (c) 2011 Zynga Inc.
  5. Copyright (c) 2013-2017 Chukong Technologies Inc.
  6. http://www.cocos2d-x.org
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. ****************************************************************************/
  23. #ifndef __CCPARTICLE_EXAMPLE_H__
  24. #define __CCPARTICLE_EXAMPLE_H__
  25. #include "2d/CCParticleSystemQuad.h"
  26. NS_CC_BEGIN
  27. /**
  28. * @addtogroup _2d
  29. * @{
  30. */
  31. /** @class ParticleFire
  32. * @brief A fire particle system.
  33. */
  34. class CC_DLL ParticleFire : public ParticleSystemQuad
  35. {
  36. public:
  37. /** Create a fire particle system.
  38. *
  39. * @return An autoreleased ParticleFire object.
  40. */
  41. static ParticleFire* create();
  42. /** Create a fire particle system withe a fixed number of particles.
  43. *
  44. * @param numberOfParticles A given number of particles.
  45. * @return An autoreleased ParticleFire object.
  46. * @js NA
  47. */
  48. static ParticleFire* createWithTotalParticles(int numberOfParticles);
  49. CC_CONSTRUCTOR_ACCESS:
  50. /**
  51. * @js ctor
  52. */
  53. ParticleFire(){}
  54. /**
  55. * @js NA
  56. * @lua NA
  57. */
  58. virtual ~ParticleFire(){}
  59. bool init() override { return initWithTotalParticles(250); }
  60. virtual bool initWithTotalParticles(int numberOfParticles) override;
  61. private:
  62. CC_DISALLOW_COPY_AND_ASSIGN(ParticleFire);
  63. };
  64. /** @class ParticleFireworks
  65. * @brief A fireworks particle system.
  66. */
  67. class CC_DLL ParticleFireworks : public ParticleSystemQuad
  68. {
  69. public:
  70. /** Create a fireworks particle system.
  71. *
  72. * @return An autoreleased ParticleFireworks object.
  73. */
  74. static ParticleFireworks* create();
  75. /** Create a fireworks particle system withe a fixed number of particles.
  76. *
  77. * @param numberOfParticles A given number of particles.
  78. * @return An autoreleased ParticleFireworks object.
  79. * @js NA
  80. */
  81. static ParticleFireworks* createWithTotalParticles(int numberOfParticles);
  82. CC_CONSTRUCTOR_ACCESS:
  83. /**
  84. * @js ctor
  85. */
  86. ParticleFireworks(){}
  87. /**
  88. * @js NA
  89. * @lua NA
  90. */
  91. virtual ~ParticleFireworks(){}
  92. bool init(){ return initWithTotalParticles(1500); }
  93. virtual bool initWithTotalParticles(int numberOfParticles);
  94. private:
  95. CC_DISALLOW_COPY_AND_ASSIGN(ParticleFireworks);
  96. };
  97. /** @class ParticleSun
  98. * @brief A sun particle system.
  99. */
  100. class CC_DLL ParticleSun : public ParticleSystemQuad
  101. {
  102. public:
  103. /** Create a sun particle system.
  104. *
  105. * @return An autoreleased ParticleSun object.
  106. */
  107. static ParticleSun* create();
  108. /** Create a sun particle system withe a fixed number of particles.
  109. *
  110. * @param numberOfParticles A given number of particles.
  111. * @return An autoreleased ParticleSun object.
  112. * @js NA
  113. */
  114. static ParticleSun* createWithTotalParticles(int numberOfParticles);
  115. CC_CONSTRUCTOR_ACCESS:
  116. /**
  117. * @js ctor
  118. */
  119. ParticleSun(){}
  120. /**
  121. * @js NA
  122. * @lua NA
  123. */
  124. virtual ~ParticleSun(){}
  125. bool init(){ return initWithTotalParticles(350); }
  126. virtual bool initWithTotalParticles(int numberOfParticles);
  127. private:
  128. CC_DISALLOW_COPY_AND_ASSIGN(ParticleSun);
  129. };
  130. /** @class ParticleGalaxy
  131. * @brief A galaxy particle system.
  132. */
  133. class CC_DLL ParticleGalaxy : public ParticleSystemQuad
  134. {
  135. public:
  136. /** Create a galaxy particle system.
  137. *
  138. * @return An autoreleased ParticleGalaxy object.
  139. */
  140. static ParticleGalaxy* create();
  141. /** Create a galaxy particle system withe a fixed number of particles.
  142. *
  143. * @param numberOfParticles A given number of particles.
  144. * @return An autoreleased ParticleGalaxy object.
  145. * @js NA
  146. */
  147. static ParticleGalaxy* createWithTotalParticles(int numberOfParticles);
  148. CC_CONSTRUCTOR_ACCESS:
  149. /**
  150. * @js ctor
  151. */
  152. ParticleGalaxy(){}
  153. /**
  154. * @js NA
  155. * @lua NA
  156. */
  157. virtual ~ParticleGalaxy(){}
  158. bool init(){ return initWithTotalParticles(200); }
  159. virtual bool initWithTotalParticles(int numberOfParticles);
  160. private:
  161. CC_DISALLOW_COPY_AND_ASSIGN(ParticleGalaxy);
  162. };
  163. /** @class ParticleFlower
  164. * @brief A flower particle system.
  165. */
  166. class CC_DLL ParticleFlower : public ParticleSystemQuad
  167. {
  168. public:
  169. /** Create a flower particle system.
  170. *
  171. * @return An autoreleased ParticleFlower object.
  172. */
  173. static ParticleFlower* create();
  174. /** Create a flower particle system withe a fixed number of particles.
  175. *
  176. * @param numberOfParticles A given number of particles.
  177. * @return An autoreleased ParticleFlower object.
  178. * @js NA
  179. */
  180. static ParticleFlower* createWithTotalParticles(int numberOfParticles);
  181. CC_CONSTRUCTOR_ACCESS:
  182. /**
  183. * @js ctor
  184. */
  185. ParticleFlower(){}
  186. /**
  187. * @js NA
  188. * @lua NA
  189. */
  190. virtual ~ParticleFlower(){}
  191. bool init(){ return initWithTotalParticles(250); }
  192. virtual bool initWithTotalParticles(int numberOfParticles);
  193. private:
  194. CC_DISALLOW_COPY_AND_ASSIGN(ParticleFlower);
  195. };
  196. /** @class ParticleMeteor
  197. * @brief A meteor particle system.
  198. */
  199. class CC_DLL ParticleMeteor : public ParticleSystemQuad
  200. {
  201. public:
  202. /** Create a meteor particle system.
  203. *
  204. * @return An autoreleased ParticleMeteor object.
  205. */
  206. static ParticleMeteor * create();
  207. /** Create a meteor particle system withe a fixed number of particles.
  208. *
  209. * @param numberOfParticles A given number of particles.
  210. * @return An autoreleased ParticleMeteor object.
  211. * @js NA
  212. */
  213. static ParticleMeteor* createWithTotalParticles(int numberOfParticles);
  214. CC_CONSTRUCTOR_ACCESS:
  215. /**
  216. * @js ctor
  217. */
  218. ParticleMeteor(){}
  219. /**
  220. * @js NA
  221. * @lua NA
  222. */
  223. virtual ~ParticleMeteor(){}
  224. bool init(){ return initWithTotalParticles(150); }
  225. virtual bool initWithTotalParticles(int numberOfParticles);
  226. private:
  227. CC_DISALLOW_COPY_AND_ASSIGN(ParticleMeteor);
  228. };
  229. /** @class ParticleSpiral
  230. * @brief An spiral particle system.
  231. */
  232. class CC_DLL ParticleSpiral : public ParticleSystemQuad
  233. {
  234. public:
  235. /** Create a spiral particle system.
  236. *
  237. * @return An autoreleased ParticleSpiral object.
  238. */
  239. static ParticleSpiral* create();
  240. /** Create a spiral particle system withe a fixed number of particles.
  241. *
  242. * @param numberOfParticles A given number of particles.
  243. * @return An autoreleased ParticleSpiral object.
  244. * @js NA
  245. */
  246. static ParticleSpiral* createWithTotalParticles(int numberOfParticles);
  247. CC_CONSTRUCTOR_ACCESS:
  248. /**
  249. * @js ctor
  250. */
  251. ParticleSpiral(){}
  252. /**
  253. * @js NA
  254. * @lua NA
  255. */
  256. virtual ~ParticleSpiral(){}
  257. bool init(){ return initWithTotalParticles(500); }
  258. virtual bool initWithTotalParticles(int numberOfParticles);
  259. private:
  260. CC_DISALLOW_COPY_AND_ASSIGN(ParticleSpiral);
  261. };
  262. /** @class ParticleExplosion
  263. * @brief An explosion particle system.
  264. */
  265. class CC_DLL ParticleExplosion : public ParticleSystemQuad
  266. {
  267. public:
  268. /** Create a explosion particle system.
  269. *
  270. * @return An autoreleased ParticleExplosion object.
  271. */
  272. static ParticleExplosion* create();
  273. /** Create a explosion particle system withe a fixed number of particles.
  274. *
  275. * @param numberOfParticles A given number of particles.
  276. * @return An autoreleased ParticleExplosion object.
  277. * @js NA
  278. */
  279. static ParticleExplosion* createWithTotalParticles(int numberOfParticles);
  280. CC_CONSTRUCTOR_ACCESS:
  281. /**
  282. * @js ctor
  283. */
  284. ParticleExplosion(){}
  285. /**
  286. * @js NA
  287. * @lua NA
  288. */
  289. virtual ~ParticleExplosion(){}
  290. bool init(){ return initWithTotalParticles(700); }
  291. virtual bool initWithTotalParticles(int numberOfParticles);
  292. private:
  293. CC_DISALLOW_COPY_AND_ASSIGN(ParticleExplosion);
  294. };
  295. /** @class ParticleSmoke
  296. * @brief An smoke particle system.
  297. */
  298. class CC_DLL ParticleSmoke : public ParticleSystemQuad
  299. {
  300. public:
  301. /** Create a smoke particle system.
  302. *
  303. * @return An autoreleased ParticleSmoke object.
  304. */
  305. static ParticleSmoke* create();
  306. /** Create a smoke particle system withe a fixed number of particles.
  307. *
  308. * @param numberOfParticles A given number of particles.
  309. * @return An autoreleased ParticleSmoke object.
  310. * @js NA
  311. */
  312. static ParticleSmoke* createWithTotalParticles(int numberOfParticles);
  313. CC_CONSTRUCTOR_ACCESS:
  314. /**
  315. * @js ctor
  316. */
  317. ParticleSmoke(){}
  318. /**
  319. * @js NA
  320. * @lua NA
  321. */
  322. virtual ~ParticleSmoke(){}
  323. bool init(){ return initWithTotalParticles(200); }
  324. virtual bool initWithTotalParticles(int numberOfParticles);
  325. private:
  326. CC_DISALLOW_COPY_AND_ASSIGN(ParticleSmoke);
  327. };
  328. /** @class ParticleSnow
  329. * @brief An snow particle system.
  330. */
  331. class CC_DLL ParticleSnow : public ParticleSystemQuad
  332. {
  333. public:
  334. /** Create a snow particle system.
  335. *
  336. * @return An autoreleased ParticleSnow object.
  337. */
  338. static ParticleSnow* create();
  339. /** Create a snow particle system withe a fixed number of particles.
  340. *
  341. * @param numberOfParticles A given number of particles.
  342. * @return An autoreleased ParticleSnow object.
  343. * @js NA
  344. */
  345. static ParticleSnow* createWithTotalParticles(int numberOfParticles);
  346. CC_CONSTRUCTOR_ACCESS:
  347. /**
  348. * @js ctor
  349. */
  350. ParticleSnow(){}
  351. /**
  352. * @js NA
  353. * @lua NA
  354. */
  355. virtual ~ParticleSnow(){}
  356. bool init(){ return initWithTotalParticles(700); }
  357. virtual bool initWithTotalParticles(int numberOfParticles);
  358. private:
  359. CC_DISALLOW_COPY_AND_ASSIGN(ParticleSnow);
  360. };
  361. /** @class ParticleRain
  362. * @brief A rain particle system.
  363. */
  364. class CC_DLL ParticleRain : public ParticleSystemQuad
  365. {
  366. public:
  367. /** Create a rain particle system.
  368. *
  369. * @return An autoreleased ParticleRain object.
  370. */
  371. static ParticleRain* create();
  372. /** Create a rain particle system withe a fixed number of particles.
  373. *
  374. * @param numberOfParticles A given number of particles.
  375. * @return An autoreleased ParticleRain object.
  376. * @js NA
  377. */
  378. static ParticleRain* createWithTotalParticles(int numberOfParticles);
  379. CC_CONSTRUCTOR_ACCESS:
  380. /**
  381. * @js ctor
  382. */
  383. ParticleRain(){}
  384. /**
  385. * @js NA
  386. * @lua NA
  387. */
  388. virtual ~ParticleRain(){}
  389. bool init(){ return initWithTotalParticles(1000); }
  390. virtual bool initWithTotalParticles(int numberOfParticles);
  391. private:
  392. CC_DISALLOW_COPY_AND_ASSIGN(ParticleRain);
  393. };
  394. // end of _2d group
  395. /// @}
  396. NS_CC_END
  397. #endif //__CCPARTICLE_EXAMPLE_H__