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
Key of config
container
The container of game canvas, equals to cc.container
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.

Method Detail

  • 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.