ParticlePlayer_ScriptBinding.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. ConsoleMethod(ParticlePlayer, setParticleAsset, void, 3, 3, "(particleAssetId?) Sets the particle asset Id to play.\n"
  23. "@param particleAssetId The particle asset Id to play.\n"
  24. "@return No return value.")
  25. {
  26. object->setParticle( argv[2] );
  27. }
  28. //-----------------------------------------------------------------------------
  29. ConsoleMethod(ParticlePlayer, getParticleAsset, const char*, 2, 2, "() Gets the particle asset Id.\n"
  30. "@return The particle asset Id.")
  31. {
  32. return object->getParticle();
  33. }
  34. //-----------------------------------------------------------------------------
  35. ConsoleMethod(ParticlePlayer, setCameraIdleDistance, void, 3, 3, "(idleDistance) Sets the distance from any camera when the particle player will become idle i.e. stop integrating and rendering.\n"
  36. "@param pauseDistance The distance from any camera when the particle player will become idle i.e. stop integrating and rendering.\n"
  37. "@return No return value.")
  38. {
  39. object->setCameraIdleDistance( dAtof(argv[2]) );
  40. }
  41. //-----------------------------------------------------------------------------
  42. ConsoleMethod(ParticlePlayer, getCameraIdleDistance, F32, 2, 2, "() Gets the distance from any camera when the particle player will become idle i.e. stop integrating and rendering.\n"
  43. "@return The distance from any camera when the particle player will become idle i.e. stop integrating and rendering.")
  44. {
  45. return object->getCameraIdleDistance();
  46. }
  47. //-----------------------------------------------------------------------------
  48. ConsoleMethod(ParticlePlayer, setEmissionRateScale, void, 3, 3, "(scale) Sets the scale for the particle player emission rate.\n"
  49. "@param scale The scale for the particle player emission rate.\n"
  50. "@return No return value.")
  51. {
  52. object->setEmissionRateScale( dAtof(argv[2]) );
  53. }
  54. //-----------------------------------------------------------------------------
  55. ConsoleMethod(ParticlePlayer, getEmissionRateScale, F32, 2, 2, "() Gets the scale for the particle player emission rate.\n"
  56. "@return The scale for the particle player emission rate.")
  57. {
  58. return object->getEmissionRateScale();
  59. }
  60. //-----------------------------------------------------------------------------
  61. ConsoleMethod(ParticlePlayer, setSizeScale, void, 3, 3, "(scale) Sets the scale for the particle player particle sizes.\n"
  62. "@param scale The scale for the particle player particle sizes.\n"
  63. "@return No return value.")
  64. {
  65. object->setSizeScale( dAtof(argv[2]) );
  66. }
  67. //-----------------------------------------------------------------------------
  68. ConsoleMethod(ParticlePlayer, getSizeScale, F32, 2, 2, "() Gets the scale for the particle player particle sizes.\n"
  69. "@return The scale for the particle player particle sizes.")
  70. {
  71. return object->getSizeScale();
  72. }
  73. //-----------------------------------------------------------------------------
  74. ConsoleMethod(ParticlePlayer, setForceScale, void, 3, 3, "(scale) Sets the scale for the particle player forces.\n"
  75. "@param scale The scale for the particle player forces.\n"
  76. "@return No return value.")
  77. {
  78. object->setForceScale( dAtof(argv[2]) );
  79. }
  80. //-----------------------------------------------------------------------------
  81. ConsoleMethod(ParticlePlayer, getForceScale, F32, 2, 2, "() Gets the scale for the particle player forces.\n"
  82. "@return The scale for the particle player forces.")
  83. {
  84. return object->getForceScale();
  85. }
  86. //-----------------------------------------------------------------------------
  87. ConsoleMethod(ParticlePlayer, play, bool, 2, 3, "([resetParticles]) Starts the particle player playing.\n"
  88. "@param resetParticles Whether to reset any existing particles before starting to play. Default is true.\n"
  89. "@return Returns true on success and false otherwise.")
  90. {
  91. // Fetch the reset-particle flag.
  92. const bool resetParticles = argc >= 3 ? dAtob(argv[2]) : true;
  93. return object->play( resetParticles );
  94. }
  95. //-----------------------------------------------------------------------------
  96. ConsoleMethod(ParticlePlayer, stop, void, 2, 4, "([waitForParticles?, killEffect?]) - Stops the Particle Effect.\n"
  97. "@param waitForParticles Whether or not the effect should wait until all of its particles have run their course, or just stop immediately and delete the particles (default true).\n"
  98. "@param killEffect Whether or not the effect should be deleted after it has stopped (default false).\n"
  99. "@return No return value.")
  100. {
  101. // Fetch the wait-for-particles flag.
  102. const bool waitForParticles = argc >= 3 ? dAtob(argv[2]) : true;
  103. // Fetch the kill-effect flag.
  104. const bool killEffect = argc >= 4 ? dAtob(argv[3]) : false;
  105. // Stop playing.
  106. object->stop( waitForParticles, killEffect );
  107. }
  108. //-----------------------------------------------------------------------------
  109. ConsoleMethod(ParticlePlayer, getIsPlaying, bool, 2, 2, "() Gets whether the particle player is playing or not.\n"
  110. "@return Whether the particle player is playing or not." )
  111. {
  112. return object->getIsPlaying();
  113. }
  114. //-----------------------------------------------------------------------------
  115. ConsoleMethod(ParticlePlayer, setPaused, void, 3, 3, "(paused?) Sets whether the particle player is paused or not.\n"
  116. "@param paused Whether the particle player is paused or not.\n"
  117. "@return No return value.")
  118. {
  119. object->setPaused( dAtob(argv[2]) );
  120. }
  121. //-----------------------------------------------------------------------------
  122. ConsoleMethod(ParticlePlayer, getPaused, bool, 2, 2, "() Gets whether the particle player is paused or not.\n"
  123. "@return Whether the particle player is paused or not.")
  124. {
  125. return object->getPaused();
  126. }
  127. //-----------------------------------------------------------------------------
  128. ConsoleMethod(ParticlePlayer, setEmitterPaused, void, 4, 4, "(paused, emitterIndex) Sets whether the specified particle emitter is paused or not.\n"
  129. "@param paused Whether the specified particle emitter is paused or not.\n"
  130. "@param emitterIndex The index of the emitter to modify.\n"
  131. "@return No return value.")
  132. {
  133. object->setEmitterPaused( dAtob(argv[2]), dAtoi(argv[3]) );
  134. }
  135. //-----------------------------------------------------------------------------
  136. ConsoleMethod(ParticlePlayer, getEmitterPaused, bool, 3, 3, "(emitterIndex) Gets whether the specified particle emitter is paused or not.\n"
  137. "@param emitterIndex The index of the emitter to modify.\n"
  138. "@return Whether the specified particle emitter is paused or not.")
  139. {
  140. return object->getEmitterPaused( dAtob(argv[2]) );
  141. }
  142. //-----------------------------------------------------------------------------
  143. ConsoleMethod(ParticlePlayer, setEmitterVisible, void, 4, 4, "(visible, emitterIndex) Sets whether the specified particle emitter is visible or not.\n"
  144. "@param paused Whether the specified particle emitter is visible or not.\n"
  145. "@param emitterIndex The index of the emitter to modify.\n"
  146. "@return No return value.")
  147. {
  148. object->setEmitterVisible( dAtob(argv[2]), dAtoi(argv[3]) );
  149. }
  150. //-----------------------------------------------------------------------------
  151. ConsoleMethod(ParticlePlayer, getEmitterVisible, bool, 3, 3, "(emitterIndex) Gets whether the specified particle emitter is visible or not.\n"
  152. "@param emitterIndex The index of the emitter to modify.\n"
  153. "@return Whether the specified particle emitter is visible or not.")
  154. {
  155. return object->getEmitterVisible( dAtob(argv[2]) );
  156. }