jetlag2d
    Preparing search index...

    Class RendererDevice

    RenderDevice is a wrapper around the PIXI Application object. It initializes the render loop, which fires at a regular interval to tell the game to advance the simulation by some number of milliseconds. Doing this many times per second is what makes our game work :)

    TODO: Pixi prefers when sprites are not removed and re-added to containers on each tick. It also has features like "interaction" that can be disabled. There's a fair bit of optimization opportunity.

    Index

    The pixi application object is responsible for drawing onto a canvas

    screenshotRequested: boolean = false

    Is someone requesting that a new screenshot be taken?

    • get now(): number

      The "time" in milliseconds, where 0 is when the game started. Unlike Scene.timer/TimedEvent (which only advance while their own scene is actually being stepped), this keeps ticking every render frame no matter what's currently showing.

      Returns number

    • Add a filter to the entire rendered frame, instead of to one specific SpriteLocation container. This applies to the whole PIXI stage (world, hud, overlay, background, and foreground, all composited together), unlike addFilter/addZFilter, which scope to one container or Z index.

      Parameters

      Returns void

    • Change the size of the canvas, because the window changed size. The canvas is drawn with one real pixel per screen pixel (or more, on a high-density display), so the game stays sharp at any size.

      Parameters

      • screenWidth: number

        The new width of the screen

      • screenHeight: number

        The new height of the screen

      Returns void

    • Turn hitbox/debug outline rendering on or off at runtime.

      NB: When Config.hitBoxes is false, this doesn't turn debug boxes on. It just gives a way to show/hide the boxes when Config.hitBoxes is true.

      Parameters

      • visible: boolean

      Returns void