CCTransitionProgress.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. /****************************************************************************
  2. Copyright (c) 2009 Lam Pham
  3. Copyright (c) 2010-2012 cocos2d-x.org
  4. Copyright (c) 2012 Ricardo Quesada
  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 __CCTRANSITIONPROGRESS_H__
  25. #define __CCTRANSITIONPROGRESS_H__
  26. #include "2d/CCTransition.h"
  27. NS_CC_BEGIN
  28. class ProgressTimer;
  29. class RenderTexture;
  30. /**
  31. * @addtogroup _2d
  32. * @{
  33. */
  34. /** @class TransitionProgress
  35. * @brief A base class of progress transition.
  36. */
  37. class CC_DLL TransitionProgress : public TransitionScene
  38. {
  39. public:
  40. /** Creates a transition with duration and incoming scene.
  41. *
  42. * @param t Duration time, in seconds.
  43. * @param scene A given scene.
  44. * @return An autoreleased TransitionProgress object.
  45. */
  46. static TransitionProgress* create(float t, Scene* scene);
  47. //
  48. // Overrides
  49. //
  50. virtual void onEnter() override;
  51. virtual void onExit() override;
  52. CC_CONSTRUCTOR_ACCESS:
  53. TransitionProgress();
  54. virtual ~TransitionProgress(){}
  55. protected:
  56. virtual void sceneOrder() override;
  57. protected:
  58. virtual ProgressTimer* progressTimerNodeWithRenderTexture(RenderTexture* texture);
  59. virtual void setupTransition();
  60. protected:
  61. float _to;
  62. float _from;
  63. Scene* _sceneToBeModified;
  64. };
  65. /** @class TransitionProgressRadialCCW
  66. * @brief TransitionRadialCCW transition.
  67. A counter clock-wise radial transition to the next scene
  68. */
  69. class CC_DLL TransitionProgressRadialCCW : public TransitionProgress
  70. {
  71. public:
  72. /** Creates a transition with duration and incoming scene.
  73. *
  74. * @param t Duration time, in seconds.
  75. * @param scene A given scene.
  76. * @return An autoreleased TransitionProgressRadialCCW object.
  77. */
  78. static TransitionProgressRadialCCW* create(float t, Scene* scene);
  79. CC_CONSTRUCTOR_ACCESS:
  80. /**
  81. * @js ctor
  82. */
  83. TransitionProgressRadialCCW(){}
  84. virtual ~TransitionProgressRadialCCW(){}
  85. protected:
  86. //
  87. // Overrides
  88. //
  89. virtual ProgressTimer* progressTimerNodeWithRenderTexture(RenderTexture* texture) override;
  90. };
  91. /** @class TransitionProgressRadialCW
  92. * @brief TransitionRadialCW transition.
  93. A counter clock-wise radial transition to the next scene.
  94. */
  95. class CC_DLL TransitionProgressRadialCW : public TransitionProgress
  96. {
  97. public:
  98. /** Creates a transition with duration and incoming scene.
  99. *
  100. * @param t Duration time, in seconds.
  101. * @param scene A given scene.
  102. * @return An autoreleased TransitionProgressRadialCW object.
  103. */
  104. static TransitionProgressRadialCW* create(float t, Scene* scene);
  105. CC_CONSTRUCTOR_ACCESS:
  106. /**
  107. * @js ctor
  108. */
  109. TransitionProgressRadialCW(){}
  110. virtual ~TransitionProgressRadialCW(){}
  111. protected:
  112. //
  113. // Overrides
  114. //
  115. virtual ProgressTimer* progressTimerNodeWithRenderTexture(RenderTexture* texture) override;
  116. };
  117. /** @class TransitionProgressHorizontal
  118. * @brief TransitionProgressHorizontal transition.
  119. A clock-wise radial transition to the next scene
  120. */
  121. class CC_DLL TransitionProgressHorizontal : public TransitionProgress
  122. {
  123. public:
  124. /** Creates a transition with duration and incoming scene.
  125. *
  126. * @param t Duration time, in seconds.
  127. * @param scene A given scene.
  128. * @return An autoreleased TransitionProgressHorizontal object.
  129. */
  130. static TransitionProgressHorizontal* create(float t, Scene* scene);
  131. CC_CONSTRUCTOR_ACCESS:
  132. /**
  133. * @js ctor
  134. */
  135. TransitionProgressHorizontal(){}
  136. virtual ~TransitionProgressHorizontal(){}
  137. protected:
  138. //
  139. // Overrides
  140. //
  141. virtual ProgressTimer* progressTimerNodeWithRenderTexture(RenderTexture* texture) override;
  142. };
  143. /** @class TransitionProgressVertical
  144. * @brief TransitionProgressVertical transition.
  145. */
  146. class CC_DLL TransitionProgressVertical : public TransitionProgress
  147. {
  148. public:
  149. /** Creates a transition with duration and incoming scene.
  150. *
  151. * @param t Duration time, in seconds.
  152. * @param scene A given scene.
  153. * @return An autoreleased TransitionProgressVertical object.
  154. */
  155. static TransitionProgressVertical* create(float t, Scene* scene);
  156. CC_CONSTRUCTOR_ACCESS:
  157. /**
  158. * @js ctor
  159. */
  160. TransitionProgressVertical(){}
  161. virtual ~TransitionProgressVertical(){}
  162. protected:
  163. //
  164. // Overrides
  165. //
  166. virtual ProgressTimer* progressTimerNodeWithRenderTexture(RenderTexture* texture) override;
  167. };
  168. /** @class TransitionProgressInOut
  169. * @brief TransitionProgressInOut transition.
  170. */
  171. class CC_DLL TransitionProgressInOut : public TransitionProgress
  172. {
  173. public:
  174. /** Creates a transition with duration and incoming scene.
  175. *
  176. * @param t Duration time, in seconds.
  177. * @param scene A given scene.
  178. * @return An autoreleased TransitionProgressInOut object.
  179. */
  180. static TransitionProgressInOut* create(float t, Scene* scene);
  181. CC_CONSTRUCTOR_ACCESS:
  182. /**
  183. * @js ctor
  184. */
  185. TransitionProgressInOut(){}
  186. virtual ~TransitionProgressInOut(){}
  187. protected:
  188. //
  189. // Overrides
  190. //
  191. virtual ProgressTimer* progressTimerNodeWithRenderTexture(RenderTexture* texture) override;
  192. virtual void sceneOrder() override;
  193. virtual void setupTransition() override;
  194. };
  195. /** @class TransitionProgressOutIn
  196. * @brief TransitionProgressOutIn transition.
  197. */
  198. class CC_DLL TransitionProgressOutIn : public TransitionProgress
  199. {
  200. public:
  201. /** Creates a transition with duration and incoming scene.
  202. *
  203. * @param t Duration time, in seconds.
  204. * @param scene A given scene.
  205. * @return An autoreleased TransitionProgressOutIn object.
  206. */
  207. static TransitionProgressOutIn* create(float t, Scene* scene);
  208. CC_CONSTRUCTOR_ACCESS:
  209. /**
  210. * @js ctor
  211. */
  212. TransitionProgressOutIn(){}
  213. virtual ~TransitionProgressOutIn(){}
  214. protected:
  215. //
  216. // Overrides
  217. //
  218. virtual ProgressTimer* progressTimerNodeWithRenderTexture(RenderTexture* texture) override;
  219. };
  220. // end of _2d group
  221. /// @}
  222. NS_CC_END
  223. #endif /* __CCTRANSITIONPROGRESS_H__ */