-
Notifications
You must be signed in to change notification settings - Fork 0
Suki Core
The suki module has three exports:
-
sukiAn instance of the
Sukiclass.Sukiclass is not exported, as it's intentionally instantiated and exported to prevent confusion and duplication. -
eventsA 'enum' that for each built-in event that
sukiwill emit. Custom events won't be added toevents. See "Event Lifecycle" below for more details" -
SubSystemA mixin class for extending Suki.js. You can use
SubSystemto easily create a class the hooks into the event lifecycle ofsuki.js
The event lifecycle - i.e. which events happen when, and how you can hook into them.
You can access all events from the exported events enum.
-
event.READYEmitted when the document, and subsequently,
sukiis able to start the game loop. -
event.STARTEmitted after the
suki.start()has been called, and the main game loop has begun. Because this is called synchronously, it will likely be called before the first frame. -
event.STOPEmitted after the
suki.stop()has been called, and the main game loop has been halted. -
event.TICKEmitted for every game tick of the game loop. Any events listening to this event should be aware of their highly likely cost to performance.
-
event.STEPEmitted for each gameloop step. A step occurs at a periodic rate related to the framerate. If you need more information, it's suggest you seek further reading about game loop steps.
-
event.PRERENDERtodo
export const events = { READY: "ready", TICK: "tick", STEP: "step", PRERENDER: "pre-render", RENDER: "render", POSTRENDER: "post-render", }