CCDirector.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. /****************************************************************************
  2. Copyright (c) 2008-2010 Ricardo Quesada
  3. Copyright (c) 2010-2013 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 __CCDIRECTOR_H__
  25. #define __CCDIRECTOR_H__
  26. #include <stack>
  27. #include <thread>
  28. #include <chrono>
  29. #include "platform/CCPlatformMacros.h"
  30. #include "base/CCRef.h"
  31. #include "base/CCVector.h"
  32. #include "2d/CCScene.h"
  33. #include "math/CCMath.h"
  34. #include "platform/CCGL.h"
  35. #include "platform/CCGLView.h"
  36. NS_CC_BEGIN
  37. /**
  38. * @addtogroup base
  39. * @{
  40. */
  41. /* Forward declarations. */
  42. class LabelAtlas;
  43. //class GLView;
  44. class DirectorDelegate;
  45. class Node;
  46. class Scheduler;
  47. class ActionManager;
  48. class EventDispatcher;
  49. class EventCustom;
  50. class EventListenerCustom;
  51. class TextureCache;
  52. class Renderer;
  53. class Camera;
  54. class Console;
  55. namespace experimental
  56. {
  57. class FrameBuffer;
  58. }
  59. /**
  60. * @brief Matrix stack type.
  61. */
  62. enum class MATRIX_STACK_TYPE
  63. {
  64. /// Model view matrix stack
  65. MATRIX_STACK_MODELVIEW,
  66. /// projection matrix stack
  67. MATRIX_STACK_PROJECTION,
  68. /// texture matrix stack
  69. MATRIX_STACK_TEXTURE
  70. };
  71. /**
  72. @brief Class that creates and handles the main Window and manages how
  73. and when to execute the Scenes.
  74. The Director is also responsible for:
  75. - initializing the OpenGL context
  76. - setting the OpenGL buffer depth (default one is 0-bit)
  77. - setting the projection (default one is 3D)
  78. Since the Director is a singleton, the standard way to use it is by calling:
  79. _ Director::getInstance()->methodName();
  80. */
  81. class CC_DLL Director : public Ref
  82. {
  83. public:
  84. /** Director will trigger an event before set next scene. */
  85. static const char* EVENT_BEFORE_SET_NEXT_SCENE;
  86. /** Director will trigger an event after set next scene. */
  87. static const char* EVENT_AFTER_SET_NEXT_SCENE;
  88. /** Director will trigger an event when projection type is changed. */
  89. static const char* EVENT_PROJECTION_CHANGED;
  90. /** Director will trigger an event before Schedule::update() is invoked. */
  91. static const char* EVENT_BEFORE_UPDATE;
  92. /** Director will trigger an event after Schedule::update() is invoked. */
  93. static const char* EVENT_AFTER_UPDATE;
  94. /** Director will trigger an event while resetting Director */
  95. static const char* EVENT_RESET;
  96. /** Director will trigger an event after Scene::render() is invoked. */
  97. static const char* EVENT_AFTER_VISIT;
  98. /** Director will trigger an event after a scene is drawn, the data is sent to GPU. */
  99. static const char* EVENT_AFTER_DRAW;
  100. /** Director will trigger an event before a scene is drawn, right after clear. */
  101. static const char* EVENT_BEFORE_DRAW;
  102. /**
  103. * @brief Possible OpenGL projections used by director
  104. */
  105. enum class Projection
  106. {
  107. /// Sets a 2D projection (orthogonal projection).
  108. _2D,
  109. /// Sets a 3D projection with a fovy=60, znear=0.5f and zfar=1500.
  110. _3D,
  111. /// It calls "updateProjection" on the projection delegate.
  112. CUSTOM,
  113. /// Default projection is 3D projection.
  114. DEFAULT = _3D,
  115. };
  116. /**
  117. * Returns a shared instance of the director.
  118. * @js _getInstance
  119. */
  120. static Director* getInstance();
  121. /**
  122. * @deprecated Use getInstance() instead.
  123. * @js NA
  124. */
  125. CC_DEPRECATED_ATTRIBUTE static Director* sharedDirector() { return Director::getInstance(); }
  126. /**
  127. * @js ctor
  128. */
  129. Director();
  130. /**
  131. * @js NA
  132. * @lua NA
  133. */
  134. ~Director();
  135. bool init();
  136. // attribute
  137. /** Gets current running Scene. Director can only run one Scene at a time. */
  138. Scene* getRunningScene() { return _runningScene; }
  139. /** Gets the FPS value. */
  140. float getAnimationInterval() { return _animationInterval; }
  141. /** Sets the FPS value. FPS = 1/interval. */
  142. void setAnimationInterval(float interval);
  143. /** Whether or not displaying the FPS on the bottom-left corner of the screen. */
  144. bool isDisplayStats() { return _displayStats; }
  145. /** Display the FPS on the bottom-left corner of the screen. */
  146. void setDisplayStats(bool displayStats) { _displayStats = displayStats; }
  147. /** Get seconds per frame. */
  148. float getSecondsPerFrame() { return _secondsPerFrame; }
  149. /**
  150. * Get the GLView.
  151. * @lua NA
  152. */
  153. GLView* getOpenGLView() { return _openGLView; }
  154. /**
  155. * Sets the GLView.
  156. * @lua NA
  157. */
  158. void setOpenGLView(GLView *openGLView);
  159. /*
  160. * Gets singleton of TextureCache.
  161. * @js NA
  162. */
  163. TextureCache* getTextureCache() const;
  164. /** Whether or not `_nextDeltaTimeZero` is set to 0. */
  165. bool isNextDeltaTimeZero() { return _nextDeltaTimeZero; }
  166. /**
  167. * Sets the delta time between current frame and next frame is 0.
  168. * This value will be used in Schedule, and will affect all functions that are using frame delta time, such as Actions.
  169. * This value will take effect only one time.
  170. */
  171. void setNextDeltaTimeZero(bool nextDeltaTimeZero);
  172. /** Whether or not the Director is paused. */
  173. bool isPaused() { return _paused; }
  174. /** How many frames were called since the director started */
  175. unsigned int getTotalFrames() { return _totalFrames; }
  176. /** Gets an OpenGL projection.
  177. * @since v0.8.2
  178. * @lua NA
  179. */
  180. Projection getProjection() { return _projection; }
  181. /** Sets OpenGL projection. */
  182. void setProjection(Projection projection);
  183. /** Sets the glViewport.*/
  184. void setViewport();
  185. /** Whether or not the replaced scene will receive the cleanup message.
  186. * If the new scene is pushed, then the old scene won't receive the "cleanup" message.
  187. * If the new scene replaces the old one, the it will receive the "cleanup" message.
  188. * @since v0.99.0
  189. */
  190. bool isSendCleanupToScene() { return _sendCleanupToScene; }
  191. /** This object will be visited after the main scene is visited.
  192. * This object MUST implement the "visit" function.
  193. * Useful to hook a notification object, like Notifications (http://github.com/manucorporat/CCNotifications)
  194. * @since v0.99.5
  195. */
  196. Node* getNotificationNode() const { return _notificationNode; }
  197. /**
  198. * Sets the notification node.
  199. * @see Director::getNotificationNode()
  200. */
  201. void setNotificationNode(Node *node);
  202. // window size
  203. /** Returns the size of the OpenGL view in points. */
  204. const Size& getWinSize() const;
  205. /** Returns the size of the OpenGL view in pixels. */
  206. Size getWinSizeInPixels() const;
  207. /**
  208. * Returns visible size of the OpenGL view in points.
  209. * The value is equal to `Director::getWinSize()` if don't invoke `GLView::setDesignResolutionSize()`.
  210. */
  211. Size getVisibleSize() const;
  212. /** Returns visible origin coordinate of the OpenGL view in points. */
  213. Vec2 getVisibleOrigin() const;
  214. /**
  215. * Returns safe area rectangle of the OpenGL view in points.
  216. */
  217. Rect getSafeAreaRect() const;
  218. /**
  219. * Converts a screen coordinate to an OpenGL coordinate.
  220. * Useful to convert (multi) touch coordinates to the current layout (portrait or landscape).
  221. */
  222. Vec2 convertToGL(const Vec2& point);
  223. /**
  224. * Converts an OpenGL coordinate to a screen coordinate.
  225. * Useful to convert node points to window points for calls such as glScissor.
  226. */
  227. Vec2 convertToUI(const Vec2& point);
  228. /**
  229. * Gets the distance between camera and near clipping frame.
  230. * It is correct for default camera that near clipping frame is same as the screen.
  231. */
  232. float getZEye() const;
  233. // Scene Management
  234. /**
  235. * Enters the Director's main loop with the given Scene.
  236. * Call it to run only your FIRST scene.
  237. * Don't call it if there is already a running scene.
  238. *
  239. * It will call pushScene: and then it will call startAnimation
  240. * @js NA
  241. */
  242. void runWithScene(Scene *scene);
  243. /**
  244. * Suspends the execution of the running scene, pushing it on the stack of suspended scenes.
  245. * The new scene will be executed.
  246. * Try to avoid big stacks of pushed scenes to reduce memory allocation.
  247. * ONLY call it if there is a running scene.
  248. */
  249. void pushScene(Scene *scene);
  250. /**
  251. * Pops out a scene from the stack.
  252. * This scene will replace the running one.
  253. * The running scene will be deleted. If there are no more scenes in the stack the execution is terminated.
  254. * ONLY call it if there is a running scene.
  255. */
  256. void popScene();
  257. /**
  258. * Pops out all scenes from the stack until the root scene in the queue.
  259. * This scene will replace the running one.
  260. * Internally it will call `popToSceneStackLevel(1)`.
  261. */
  262. void popToRootScene();
  263. /** Pops out all scenes from the stack until it reaches `level`.
  264. If level is 0, it will end the director.
  265. If level is 1, it will pop all scenes until it reaches to root scene.
  266. If level is <= than the current stack level, it won't do anything.
  267. */
  268. void popToSceneStackLevel(int level);
  269. /** Replaces the running scene with a new one. The running scene is terminated.
  270. * ONLY call it if there is a running scene.
  271. * @js NA
  272. */
  273. void replaceScene(Scene *scene);
  274. /** Ends the execution, releases the running scene.
  275. * @lua endToLua
  276. */
  277. void end();
  278. /** Pauses the running scene.
  279. * The running scene will be _drawed_ but all scheduled timers will be paused.
  280. * While paused, the draw rate will be 4 FPS to reduce CPU consumption.
  281. */
  282. void pause();
  283. /** Resumes the paused scene.
  284. * The scheduled timers will be activated again.
  285. * The "delta time" will be 0 (as if the game wasn't paused).
  286. */
  287. void resume();
  288. /*
  289. * Restart the director.
  290. * @js NA
  291. */
  292. void restart();
  293. /** Stops the animation. Nothing will be drawn. The main loop won't be triggered anymore.
  294. * If you don't want to pause your animation call [pause] instead.
  295. */
  296. void stopAnimation();
  297. /** The main loop is triggered again.
  298. * Call this function only if [stopAnimation] was called earlier.
  299. * @warning Don't call this function to start the main loop. To run the main loop call runWithScene.
  300. */
  301. void startAnimation();
  302. /** Draw the scene.
  303. * This method is called every frame. Don't call it manually.
  304. */
  305. void drawScene();
  306. void drawMoveScene(int frameNumbers);
  307. // Memory Helper
  308. /** Removes all cocos2d cached data.
  309. * It will purge the TextureCache, SpriteFrameCache, LabelBMFont cache
  310. * @since v0.99.3
  311. */
  312. void purgeCachedData();
  313. /** Sets the default values based on the Configuration info. */
  314. void setDefaultValues();
  315. // OpenGL Helper
  316. /** Sets the OpenGL default values.
  317. * It will enable alpha blending, disable depth test.
  318. * @js NA
  319. */
  320. void setGLDefaultValues();
  321. /** Enables/disables OpenGL alpha blending. */
  322. void setAlphaBlending(bool on);
  323. /** Sets clear values for the color buffers,
  324. * value range of each element is [0.0, 1.0].
  325. * @js NA
  326. */
  327. void setClearColor(const Color4F& clearColor);
  328. /** Enables/disables OpenGL depth test. */
  329. void setDepthTest(bool on);
  330. void mainLoop();
  331. /** Invoke main loop with delta time. Then `calculateDeltaTime` can just use the delta time directly.
  332. * The delta time paseed may include vsync time. See issue #17806
  333. * @since 3.16
  334. */
  335. void mainLoop(float dt);
  336. /** The size in pixels of the surface. It could be different than the screen size.
  337. * High-res devices might have a higher surface size than the screen size.
  338. * Only available when compiled using SDK >= 4.0.
  339. * @since v0.99.4
  340. */
  341. void setContentScaleFactor(float scaleFactor);
  342. /**
  343. * Gets content scale factor.
  344. * @see Director::setContentScaleFactor()
  345. */
  346. float getContentScaleFactor() const { return _contentScaleFactor; }
  347. /** Gets the Scheduler associated with this director.
  348. * @since v2.0
  349. */
  350. Scheduler* getScheduler() const { return _scheduler; }
  351. /** Sets the Scheduler associated with this director.
  352. * @since v2.0
  353. */
  354. void setScheduler(Scheduler* scheduler);
  355. /** Gets the ActionManager associated with this director.
  356. * @since v2.0
  357. */
  358. ActionManager* getActionManager() const { return _actionManager; }
  359. /** Sets the ActionManager associated with this director.
  360. * @since v2.0
  361. */
  362. void setActionManager(ActionManager* actionManager);
  363. /** Gets the EventDispatcher associated with this director.
  364. * @since v3.0
  365. * @js NA
  366. */
  367. EventDispatcher* getEventDispatcher() const { return _eventDispatcher; }
  368. /** Sets the EventDispatcher associated with this director.
  369. * @since v3.0
  370. * @js NA
  371. */
  372. void setEventDispatcher(EventDispatcher* dispatcher);
  373. /** Returns the Renderer associated with this director.
  374. * @since v3.0
  375. */
  376. Renderer* getRenderer() const { return _renderer; }
  377. /** Returns the Console associated with this director.
  378. * @since v3.0
  379. * @js NA
  380. */
  381. Console* getConsole() const { return _console; }
  382. /* Gets delta time since last tick to main loop. */
  383. float getDeltaTime() const;
  384. /**
  385. * Gets Frame Rate.
  386. * @js NA
  387. */
  388. float getFrameRate() const { return _frameRate; }
  389. /**
  390. * Clones a specified type matrix and put it to the top of specified type of matrix stack.
  391. * @js NA
  392. */
  393. void pushMatrix(MATRIX_STACK_TYPE type);
  394. /**
  395. * Clones a projection matrix and put it to the top of projection matrix stack.
  396. * @param index The index of projection matrix stack.
  397. * @js NA
  398. */
  399. void pushProjectionMatrix(size_t index);
  400. /** Pops the top matrix of the specified type of matrix stack.
  401. * @js NA
  402. */
  403. void popMatrix(MATRIX_STACK_TYPE type);
  404. /** Pops the top matrix of the projection matrix stack.
  405. * @param index The index of projection matrix stack.
  406. * @js NA
  407. */
  408. void popProjectionMatrix(size_t index);
  409. /** Adds an identity matrix to the top of specified type of matrix stack.
  410. * @js NA
  411. */
  412. void loadIdentityMatrix(MATRIX_STACK_TYPE type);
  413. /** Adds an identity matrix to the top of projection matrix stack.
  414. * @param index The index of projection matrix stack.
  415. * @js NA
  416. */
  417. void loadProjectionIdentityMatrix(size_t index);
  418. /**
  419. * Adds a matrix to the top of specified type of matrix stack.
  420. *
  421. * @param type Matrix type.
  422. * @param mat The matrix that to be added.
  423. * @js NA
  424. */
  425. void loadMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
  426. /**
  427. * Adds a matrix to the top of projection matrix stack.
  428. *
  429. * @param mat The matrix that to be added.
  430. * @param index The index of projection matrix stack.
  431. * @js NA
  432. */
  433. void loadProjectionMatrix(const Mat4& mat, size_t index);
  434. /**
  435. * Multiplies a matrix to the top of specified type of matrix stack.
  436. *
  437. * @param type Matrix type.
  438. * @param mat The matrix that to be multiplied.
  439. * @js NA
  440. */
  441. void multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat);
  442. /**
  443. * Multiplies a matrix to the top of projection matrix stack.
  444. *
  445. * @param mat The matrix that to be multiplied.
  446. * @param index The index of projection matrix stack.
  447. * @js NA
  448. */
  449. void multiplyProjectionMatrix(const Mat4& mat, size_t index);
  450. /**
  451. * Gets the top matrix of specified type of matrix stack.
  452. * @js NA
  453. */
  454. const Mat4& getMatrix(MATRIX_STACK_TYPE type) const;
  455. /**
  456. * Gets the top matrix of projection matrix stack.
  457. * @param index The index of projection matrix stack.
  458. * @js NA
  459. */
  460. const Mat4& getProjectionMatrix(size_t index) const;
  461. /**
  462. * Clear all types of matrix stack, and add identity matrix to these matrix stacks.
  463. * @js NA
  464. */
  465. void resetMatrixStack();
  466. /**
  467. * Init the projection matrix stack.
  468. * @param stackCount The size of projection matrix stack.
  469. * @js NA
  470. */
  471. void initProjectionMatrixStack(size_t stackCount);
  472. /**
  473. * Get the size of projection matrix stack.
  474. * @js NA
  475. */
  476. size_t getProjectionMatrixStackSize();
  477. /**
  478. * returns the cocos2d thread id.
  479. Useful to know if certain code is already running on the cocos2d thread
  480. */
  481. const std::thread::id& getCocos2dThreadId() const { return _cocos2d_thread_id; }
  482. /**
  483. * returns whether or not the Director is in a valid state
  484. */
  485. bool isValid() const { return !_invalid; }
  486. protected:
  487. void reset();
  488. virtual void startAnimation(SetIntervalReason reason);
  489. virtual void setAnimationInterval(float interval, SetIntervalReason reason);
  490. void purgeDirector();
  491. bool _purgeDirectorInNextLoop; // this flag will be set to true in end()
  492. void restartDirector();
  493. bool _restartDirectorInNextLoop; // this flag will be set to true in restart()
  494. void setNextScene();
  495. void updateFrameRate();
  496. #if !CC_STRIP_FPS
  497. void showStats();
  498. void createStatsLabel();
  499. void calculateMPF();
  500. void getFPSImageData(unsigned char** datapointer, ssize_t* length);
  501. #endif
  502. /** calculates delta time since last time it was called */
  503. void calculateDeltaTime();
  504. //textureCache creation or release
  505. void initTextureCache();
  506. void destroyTextureCache();
  507. void initMatrixStack();
  508. std::stack<Mat4> _modelViewMatrixStack;
  509. /** In order to support GL MultiView features, we need to use the matrix array,
  510. but we don't know the number of MultiView, so using the vector instead.
  511. */
  512. std::vector< std::stack<Mat4> > _projectionMatrixStackList;
  513. std::stack<Mat4> _textureMatrixStack;
  514. /** Scheduler associated with this director
  515. @since v2.0
  516. */
  517. Scheduler *_scheduler;
  518. /** ActionManager associated with this director
  519. @since v2.0
  520. */
  521. ActionManager *_actionManager;
  522. /** EventDispatcher associated with this director
  523. @since v3.0
  524. */
  525. EventDispatcher* _eventDispatcher;
  526. EventCustom *_eventProjectionChanged, *_eventBeforeDraw, *_eventAfterDraw, *_eventAfterVisit, *_eventBeforeUpdate, *_eventAfterUpdate, *_eventResetDirector, *_beforeSetNextScene, *_afterSetNextScene;
  527. /* delta time since last tick to main loop */
  528. float _deltaTime;
  529. bool _deltaTimePassedByCaller;
  530. /* The _openGLView, where everything is rendered, GLView is a abstract class,cocos2d-x provide GLViewImpl
  531. which inherit from it as default renderer context,you can have your own by inherit from it*/
  532. GLView *_openGLView;
  533. //texture cache belongs to this director
  534. TextureCache *_textureCache;
  535. float _animationInterval;
  536. float _oldAnimationInterval;
  537. /* landscape mode ? */
  538. bool _landscape;
  539. bool _displayStats;
  540. float _accumDt;
  541. float _frameRate;
  542. LabelAtlas *_FPSLabel;
  543. LabelAtlas *_drawnBatchesLabel;
  544. LabelAtlas *_drawnVerticesLabel;
  545. /** Whether or not the Director is paused */
  546. bool _paused;
  547. /* How many frames were called since the director started */
  548. unsigned int _totalFrames;
  549. unsigned int _frames;
  550. float _secondsPerFrame;
  551. /* The running scene */
  552. Scene *_runningScene;
  553. /* will be the next 'runningScene' in the next frame
  554. nextScene is a weak reference. */
  555. Scene *_nextScene;
  556. /* If true, then "old" scene will receive the cleanup message */
  557. bool _sendCleanupToScene;
  558. /* scheduled scenes */
  559. Vector<Scene*> _scenesStack;
  560. /* last time the main loop was updated */
  561. std::chrono::steady_clock::time_point _lastUpdate;
  562. /* whether or not the next delta time will be zero */
  563. bool _nextDeltaTimeZero;
  564. /* projection used */
  565. Projection _projection;
  566. /* window size in points */
  567. Size _winSizeInPoints;
  568. /* content scale factor */
  569. float _contentScaleFactor;
  570. /* This object will be visited after the scene. Useful to hook a notification node */
  571. Node *_notificationNode;
  572. /* Renderer for the Director */
  573. Renderer *_renderer;
  574. /* Default FrameBufferObject*/
  575. experimental::FrameBuffer* _defaultFBO;
  576. /* Console for the director */
  577. Console *_console;
  578. bool _isStatusLabelUpdated;
  579. /* cocos2d thread id */
  580. std::thread::id _cocos2d_thread_id;
  581. /* whether or not the director is in a valid state */
  582. bool _invalid;
  583. // GLView will recreate stats labels to fit visible rect
  584. friend class GLView;
  585. bool bFlag;
  586. };
  587. // FIXME: Added for backward compatibility in case
  588. // someone is subclassing it.
  589. // Should be removed in v4.0
  590. class DisplayLinkDirector : public Director
  591. {};
  592. // end of base group
  593. /** @} */
  594. NS_CC_END
  595. #endif // __CCDIRECTOR_H__