
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
UtilsSfxGfxInputAssetsCollisionBooleanBooleanBooleanGameTimeStringPromiseBooleanNumberNumberNumberLoggerCreate the Shaku main object.
UtilsDifferent utilities and framework objects, like vectors, rectangles, colors, etc.
Kind: instance property of Shaku
SfxSound effects and music manager.
Kind: instance property of Shaku
GfxGraphics manager.
Kind: instance property of Shaku
InputInput manager.
Kind: instance property of Shaku
AssetsAssets manager.
Kind: instance property of Shaku
CollisionCollision detection manager.
Kind: instance property of Shaku
BooleanIf true, will pause the updates and drawing calls when window is not focused. Will also not update elapsed time.
Kind: instance property of Shaku
BooleanSet to true to completely pause Shaku (will skip updates, drawing, and time counting).
Kind: instance property of Shaku
BooleanSet 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
GameTimeGet current frame game time. Only valid between startFrame() and endFrame().
Kind: instance property of Shaku
Returns: GameTime - Current frame’s gametime.
StringGet Shaku’s version.
Kind: instance property of Shaku
Returns: String - Shaku’s version.
PromiseMethod 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
BooleanGet 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. |
NumberReturn current FPS count. Note: will return 0 until at least one second have passed.
Kind: instance method of Shaku
Returns: Number - FPS count.
NumberGet 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.
NumberRequest 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). |
LoggerGet / create a custom logger.
Kind: instance method of Shaku
Returns: Logger - Logger instance.