like2d
    Preparing search index...

    Interface Timer

    interface Timer {
        getDelta(): number;
        getFPS(): number;
        getTime(): number;
        isSleeping(): boolean;
        sleep(duration: number): void;
    }
    Index

    Methods

    • Get dt (from the update loop) anywhere. AKA the time since the last frame.

      Returns number

    • Get an estimated FPS based on one-second average.

      Returns number

    • Whether or not the game is (supposed to be) frozen. The only callback while sleeping is draw, and calling this outside of draw will always return false -- except if you have a custom runtime.

      Returns boolean

    • Freeze the whole game for a time. Audio will keep playing, but update functions won't be called and events won't fire.

      Parameters

      • duration: number

      Returns void