Class: Game
Game is the core engine class. The game contains the game loop, which handles triggering updates in systems and setting up rendering.
Hierarchy
-
↳ Game
Implements
Table of contents
Constructors
Properties
- messageBus
- name
- subscriberID
- MESSAGE_POST_RENDER
- MESSAGE_PRE_RENDER
- MESSAGE_RENDER
- MESSAGE_STOP_GAME
Methods
Constructors
constructor
+ new Game(messageBus
: IMessageBus, name?
: string, frameRequestCallback?
: (callback
: FrameRequestCallback) => number, running?
: boolean, browserWindow?
: Window, subscriberID?
: number): Game
Parameters:
Name | Type | Default value |
---|---|---|
messageBus |
IMessageBus | - |
name |
string | "game" |
frameRequestCallback |
(callback : FrameRequestCallback) => number |
- |
running |
boolean | false |
browserWindow |
Window | - |
subscriberID? |
number | - |
Returns: Game
Inherited from: Subscriber
Properties
messageBus
• Protected
messageBus: IMessageBus
name
• Readonly
name: string
subscriberID
• subscriberID: number
Inherited from: Subscriber.subscriberID
MESSAGE_POST_RENDER
▪ Readonly
Static
MESSAGE_POST_RENDER: post_render= "post_render"
MESSAGE_PRE_RENDER
▪ Readonly
Static
MESSAGE_PRE_RENDER: pre_render= "pre_render"
MESSAGE_RENDER
▪ Readonly
Static
MESSAGE_RENDER: render= "render"
MESSAGE_STOP_GAME
▪ Readonly
Static
MESSAGE_STOP_GAME: jamjar_stop_game= "jamjar_stop_game"
Methods
OnMessage
▸ OnMessage(message
: IMessage): void
Parameters:
Name | Type |
---|---|
message |
IMessage |
Returns: void
Overrides: Subscriber
OnStart
▸ Protected
OnStart(): void
OnStart is triggered when the game is started.
Returns: void
OnStop
▸ Protected
OnStop(): void
OnStop is triggered when the game is stopped.
Returns: void
Start
▸ Start(): void
Start kicks off the game, setting up systems and starting the game loop.
Returns: void