1
0

CCTransitionProgress.h 7.0 KB

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