new GameLoop(p_config)
A class that enables running a game loop which guarantees
exactly
ups model updates per second (in most cases), even if the
view update rate is significantly lower.
Parameters:
| Name | Type | Description | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
p_config |
Object |
Properties
|
- Source:
Members
-
<static> CONTINUE :string
-
The action to continue the game loop.
Type:
- string
- Source:
-
<static> EVENT_CONTINUED :string
-
The name of the event
GameLoop.EVENT_CONTINUED.Type:
- string
- Source:
-
<static> EVENT_PAUSED :string
-
The name of the event
GameLoop.EVENT_PAUSED.Type:
- string
- Source:
-
<static> EVENT_RUNNING :string
-
The name of the event
GameLoop.EVENT_RUNNING.Type:
- string
- Source:
-
<static> EVENT_STARTED :string
-
The name of the event
GameLoop.EVENT_STARTED.Type:
- string
- Source:
-
<static> EVENT_STATE_HAS_CHANGED :string
-
The name of the event
GameLoop.EVENT_STATE_HAS_CHANGED.Type:
- string
- Source:
-
<static> EVENT_STOPPED :string
-
The name of the event
GameLoop.EVENT_STOPPED.Type:
- string
- Source:
-
<static> PAUSE :string
-
The action to pause the game loop.
Type:
- string
- Source:
-
<static> PAUSED :string
-
The state of the game loop when the game loop has been paused by means of the method
pause.Type:
- string
- Source:
-
<static> RUNNING :string
-
The state of the game loop when the game loop has been started or continued by means one of the methods
startandcontinue.Type:
- string
- Source:
-
<static> START :string
-
The action to start the game.
Type:
- string
- Source:
-
<static> STOP :string
-
The action to stop the game loop.
Type:
- string
- Source:
-
<static> STOPPED :string
-
The state of the game loop when the game loop has been stopped by means of the method
stop. This is the default state, after the game loop has been initialized.Type:
- string
- Source:
-
<static> TOGGLE_PAUSE_CONTINUE :string
-
The action to toggle between the states
GameLoop.PAUSEDandGameLoop.RUNNING.Type:
- string
- Source:
-
<static> TOGGLE_START_STOP :string
-
The action to toggle between the states
GameLoop.RUNNINGandGameLoop.STOPPED.Type:
- string
- Source:
-
state :string
-
The current state of the game loop.
Type:
- string
- Source:
Methods
-
continue()
-
Method to continue the game loop. A call of this method has only an effect, if the current state of the game loop is
GameLoop.PAUSED.- Source:
-
panicDefault()
-
The default panic function. It pauses the game loop.
- Source:
-
pause()
-
Method to pause the game loop. A call of this method has only an effect, if the current state of the game loop is
GameLoop.RUNNING.- Source:
-
start()
-
Method to start the game loop. A call of this method has only an effect, if the current state of the game loop is
GameLoop.STOPPED.- Source:
-
stop()
-
Method to stop the game loop. A call of this method has only an effect if the current state of the game loop is not already
GameLoop.STOPPED.- Source:
-
togglePauseContinue()
-
Method to toggle between the states
GameLoop.PAUSEDandGameLoop.RUNNING.- Source:
-
toggleStartStop()
-
Method to toggle between the states
GameLoop.RUNNINGandGameLoop.STOPPED.- Source:
Events
-
EVENT_CONTINUED
-
This event is fired when the game loop has been continued after it had been paused.
Type: Object
- Source:
Properties:
Name Type Description detailGameLoopEventDetail -
EVENT_PAUSED
-
This event is fired when the game loop has been paused while it was running.
Type: Object
- Source:
Properties:
Name Type Description detailGameLoopEventDetail -
EVENT_RUNNING
-
This event is fired when the game loop switches into the state
runningeither because it has been started or continued.Type: Object
- Source:
Properties:
Name Type Description detailGameLoopEventDetail -
EVENT_STARTED
-
This event is fired when the game loop has been started and is running. The reset function has been called (if it exists).
Type: Object
- Source:
Properties:
Name Type Description detailGameLoopEventDetail -
EVENT_STATE_HAS_CHANGED
-
This event is fired when the state of the game loop has changed.
Type: Object
- Source:
Properties:
Name Type Description detailGameLoopEventDetail -
EVENT_STOPPED
-
This event is fired when the game loop has been stopped.
Type: Object
- Source:
Properties:
Name Type Description detailGameLoopEventDetail