Options
All
  • Public
  • Public/Protected
  • All
Menu

Provides facilities for controlling the Sphere engine.

Index

Variables

Const APILevel

APILevel: number

The Sphere v2 API level supported by the engine. When new APIs are standardized, this value is increased.

Const Compiler

Compiler: string

Name and version number of the build tool used to package the game.

Const Engine

Engine: string

Name and version number of the Sphere engine in use.

Const Game

Game: object

Information about the current game. All values are taken from the game's JSON manifest (game.json).

Type declaration

  • author: string
  • main: string
  • name: string
  • resolution: string
  • saveId: string
  • summary: string

Const Version

Version: number

Sphere API version supported by the engine.

Let frameRate

frameRate: number

The current frame rate. The engine will try to maintain the FPS according to this value.

Let frameSkip

frameSkip: number

The maximum numer of consecutive frames the engine is allowed to skip.

Let fullScreen

fullScreen: boolean

true if the engine is currently in fullscreen mode, otherwise false. You can freely change this value at any time.

Let main

main: any

If the main module exports a class, the engine automatically creates an instance of it on startup. Use this to access that object from anywhere.

Functions

abort

  • abort(message: string): void
  • Abort execution immediately with an error message. This error will not be catchable.

    Parameters

    • message: string

    Returns void

now

  • now(): number
  • Get the number of frames elapsed since the engine started.

    Returns number

restart

  • restart(): void
  • Restart the engine at the end of the current frame.

    Returns void

setResolution

  • setResolution(width: number, height: number): void
  • Set the current backbuffer resolution. The contents of the backbuffer may be lost.

    Parameters

    • width: number
    • height: number

    Returns void

shutDown

  • shutDown(): void
  • Shut down the engine at the end of the current frame.

    Returns void

sleep

  • sleep(numFrames: number): Promise<void>
  • Get a promise that resolves after a given number of frames. Use with await.

    Parameters

    • numFrames: number

      The number of frames to wait before resolving the promise.

    Returns Promise<void>

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc