Shaku’s main object. This object wraps the entire lib namespace, and this is what you use to access all managers and manage your main loop.
Kind: global class
Utils
Sfx
Gfx
Input
Assets
Collision
Boolean
Boolean
Boolean
GameTime
String
Promise
Boolean
Number
Number
Number
Logger
Create the Shaku main object.
Utils
Different utilities and framework objects, like vectors, rectangles, colors, etc.
Kind: instance property of Shaku
Sfx
Sound effects and music manager.
Kind: instance property of Shaku
Gfx
Graphics manager.
Kind: instance property of Shaku
Input
Input manager.
Kind: instance property of Shaku
Assets
Assets manager.
Kind: instance property of Shaku
Collision
Collision detection manager.
Kind: instance property of Shaku
Boolean
If true, will pause the updates and drawing calls when window is not focused. Will also not update elapsed time.
Kind: instance property of Shaku
Boolean
Set to true to completely pause Shaku (will skip updates, drawing, and time counting).
Kind: instance property of Shaku
Boolean
Set to true to pause just the game time. This will not pause real-life time. If you need real-life time stop please use the Python package.
Kind: instance property of Shaku
GameTime
Get current frame game time. Only valid between startFrame() and endFrame().
Kind: instance property of Shaku
Returns: GameTime
- Current frame’s gametime.
String
Get Shaku’s version.
Kind: instance property of Shaku
Returns: String
- Shaku’s version.
Promise
Method to select managers to use + initialize them.
Kind: instance method of Shaku
Returns: Promise
- promise to resolve when finish initialization.
Param | Type | Description |
---|---|---|
[managers] | Array.<IManager> |
Array with list of managers to use or null to use all. |
Destroy all managers
Kind: instance method of Shaku
Boolean
Get if the Shaku is currently paused, either because the ‘paused’ property is set, or because the document is not focused.
Kind: instance method of Shaku
Returns: Boolean
- True if currently paused for any reason.
Start frame (update all managers).
Kind: instance method of Shaku
End frame (update all managers).
Kind: instance method of Shaku
Make Shaku run in silent mode, without logs. You can call this before init.
Kind: instance method of Shaku
Set logger to throw an error every time a log message with severity higher than warning is written. You can call this before init.
Kind: instance method of Shaku
Param | Type | Description |
---|---|---|
enable | Boolean |
Set to true to throw error on warnings. |
Number
Return current FPS count. Note: will return 0 until at least one second have passed.
Kind: instance method of Shaku
Returns: Number
- FPS count.
Number
Get how long on average it takes to complete a game frame.
Kind: instance method of Shaku
Returns: Number
- Average time, in milliseconds, it takes to complete a game frame.
Number
Request animation frame with fallbacks.
Kind: instance method of Shaku
Returns: Number
- Handle for cancellation.
Param | Type | Description |
---|---|---|
callback | function |
Method to invoke in next animation frame. |
Cancel animation frame with fallbacks.
Kind: instance method of Shaku
Param | Type | Description |
---|---|---|
id | Number |
Request handle. |
Set the logger writer class (will replace the default console output).
Kind: instance method of Shaku
Param | Type | Description |
---|---|---|
loggerHandler | \* |
New logger handler (must implement trace, debug, info, warn, error methods). |
Logger
Get / create a custom logger.
Kind: instance method of Shaku
Returns: Logger
- Logger instance.