Skip to content

Suki Core

Rory Duncan edited this page Sep 16, 2018 · 6 revisions

Suki module

Exports

The suki module has three exports:

  • suki

    An instance of the Suki class. Suki class is not exported, as it's intentionally instantiated and exported to prevent confusion and duplication.

  • events

    A 'enum' that for each built-in event that suki will emit. Custom events won't be added to events. See "Event Lifecycle" below for more details"

  • SubSystem

    A mixin class for extending Suki.js. You can use SubSystem to easily create a class the hooks into the event lifecycle of suki.js

Event Lifecycle

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.READY

    Emitted when the document, and subsequently, suki is able to start the game loop.

  • event.START

    Emitted 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.STOP

    Emitted after the suki.stop() has been called, and the main game loop has been halted.

  • event.TICK

    Emitted 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.STEP

    Emitted 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.PRERENDER

    todo

export const events = { READY: "ready", TICK: "tick", STEP: "step", PRERENDER: "pre-render", RENDER: "render", POSTRENDER: "post-render", }

Clone this wiki locally