Introduction to the main class of cocos2d-X learning: ccdirector

Source: Internet
Author: User

In the cocos2d-x, the game at any time, only one scene object instance is running, the object can be used as the current game content of the overall package object

In addition to ccdirector, The Cocos2d-x engine provides a ccdisplaylinkdirector, which is a ccddirethat can be automatically refreshed.

The main functions of ccdirector are as follows:

Ccscene * getrunningscene (void) // obtain the current running scenario

Double getanimationinterval (void) // obtain the current FPS

Virtual void setanimationinterval (double dvalue) = 0 // set FPS

Bool isdisplayfps (void) // whether the FPS is displayed at the bottom of the screen

Void setdisplayfps (bool bdisplayfps) // set to display FPS at the bottom of the screen

Cc_glview * getopenglview (void) // obtain cceglview

Void setopenglview (cc_glview * pobopenglview) // sets cceglview

Bool ispaused (void) // Of course, whether it is suitable for pausing

Unsigned int getframes (void) // gets the number of all called frames starting from ctor

Ccdirectorprojection getprojection (void) // obtain OpenGL projection

Void setprojection (ccdirectorprojection kprojection) // sets OpenGL projection

Bool issendcleanuptoscene (void) // specifies whether the cleanup time is received when the scenario is replaced. If the new scenario is pushed in, the cleanup event is not received in the old scenario, if a new scenario is replaced, the cleanup event can be received in the old scenario.

Ccsize getwinsize (void) // obtain the size of the Open GL view, in the unit of vertex

Ccsize getwinsizeinpixels (void) // obtain the open gl View Size in pixels

Ccsize getdisplaysizeinpixels (void) // obtain the display area size of the Open GL view in pixels.

Void reshapeprojection (const ccsize & newwindowsize) // change the projection size

Ccpoint converttogl (const ccpoint & obpoint) // convert the uikit coordinate system to the OpenGL Coordinate System

Ccpoint converttoui (const ccpoint & obpoint) // convert OpenGL coordinate system to uikit Coordinate System

Float getzeye (void) // obtain the position of the default lens Z

Void runwithscene (ccscene * pscene) // run scenario

Void pushscene (ccscene * pscene) // push scenario

Void popscene (void) // pop scenario

Void replacescene (ccscene * pscene) // Replace the scenario

Void pause (void) // pause the game

Void resume (void) // replies to the game

Virtual void stopanimation (void) = 0 // stop the animation

Virtual void startanimation (void) = 0 // start the animation

Void drawscene (void) // each frame is called, and you do not need to call it yourself.

Void purgecacheddata (void) // deletes cached data

Void setgldefavaluvalues (void) // sets the default value of OpenGL.

Void setalphablending (bool bon) // you can specify whether to enable the alpha channel of OpenGL.

Void setdepthtest (bool bon) // you can specify whether to test the depth of field.

Virtual void mainloop (void) = 0 // main game loop

Void applyorientation (void) // indicates that the device direction setting takes effect.

Ccdeviceorientation getdeviceorientation (void) // gets the device direction

Void setdeviceorientation (ccdeviceorientation kdeviceorientation) // sets the game landscape

Bool enableretinadisplay (bool enabled) // sets whether to enable Retina screen support.

Bool isretinadisplay () // whether to enable Retina screen support

Void resetdirector () // reset the game

Static bool setdirectortype (ccdirectortype obdirectortype) // sets directortype. Currently, kccdirectortypensttypes, kccdirectortypemainlloop, kccdirectortype-threadmainloop, kccdiretortypedisplaylknk

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.