CCParticleExamples.h 11 KB

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