Class cc.game

Class Summary
Constructor Attributes Constructor Name and Description
 
An object to boot the game.

Method Summary

Class Detail

cc.game()
An object to boot the game.

Field Detail

canvas
The canvas of the game, equals to cc._canvas
config
Config of game
<constant> CONFIG_KEY
Keys found in project.json.
container
The container of game canvas, equals to cc.container
DEBUG_MODE_ERROR
Debug mode: Error to console.
DEBUG_MODE_ERROR_FOR_WEB_PAGE
Debug mode: Error to web page.
DEBUG_MODE_INFO
Debug mode: Info, warning, error to console.
DEBUG_MODE_INFO_FOR_WEB_PAGE
Debug mode: Info, warning, error to web page.
DEBUG_MODE_NONE
Debug mode: No debugging. {@static}
DEBUG_MODE_WARN
Debug mode: Warning, error to console.
DEBUG_MODE_WARN_FOR_WEB_PAGE
Debug mode: Warning, error to web page.
<constant> EVENT_HIDE
Event that is fired when the game is hidden.
<constant> EVENT_RENDERER_INITED
Event that is fired when the renderer is done being initialized.
<constant> EVENT_RESIZE
Event that is fired when the game is resized.
<constant> EVENT_SHOW
Event that is fired when the game is shown.
frame
The outer frame of the game canvas, parent of cc.container
onStart
Callback when the scripts of engine have been load.
onStop
Callback when game exits.
<constant> RENDER_TYPE_CANVAS
<constant> RENDER_TYPE_OPENGL
<constant> RENDER_TYPE_WEBGL

Method Detail

  • end()
    End game, it will close the game window
  • isPaused()
    Check whether the game is paused.
  • pause()
    Pause the game.
  • prepare(cb)
    Prepare game.
    Parameters:
    cb
  • restart()
    Restart game.
  • resume()
    Resume the game from pause.
  • run(config, onStart)
    Run game with configuration object and onStart function.
    Parameters:
    {Object|Function} config Optional
    Pass configuration object or onStart function
    {onStart} onStart Optional
    onStart function to be executed after game initialized
  • setFrameRate(frameRate)
    Set frameRate of game.
    Parameters:
    frameRate
  • step()
    Run the game frame by frame.