Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Type aliases

StarshipDestroy

StarshipDestroy<T>: (state: T) => void

Called once to teardown

Type parameters

  • T

Type declaration

    • (state: T): void
    • Parameters

      • state: T

      Returns void

StarshipInit

StarshipInit<T>: () => T

Called once to initialize the state

Type parameters

  • T

Type declaration

    • (): T
    • Returns T

StarshipUpdate

StarshipUpdate<T, E>: (state: T, queue: E[]) => boolean | void

Called each frame

Type parameters

  • T

  • E

Type declaration

    • (state: T, queue: E[]): boolean | void
    • Parameters

      • state: T
      • queue: E[]

      Returns boolean | void

Variables

Const FONT_5x5

FONT_5x5: string = BASE64_5x5 + PARAMS_5x5

Default 5x5 font

Const FONT_8x8

FONT_8x8: string = BASE64_8x8 + PARAMS_8x8

Default 8x8 font

Functions

clear

  • clear(color?: Color): void
  • Clears the canvas

    Parameters

    • Default value color: Color = BLACK

    Returns void

drawFilledRect

drawSprite

drawText

  • drawText(src: string, text: string, pos: Vector2, color?: Color): void
  • Draws text. NOTE: Font image file should arrange ASCII characters in a 16x9 grid. Font image src should also end with a querystring specifying char width/height. Example: my_font.png?charw=8charh=8

    Parameters

    • src: string
    • text: string
    • pos: Vector2
    • Default value color: Color = WHITE

    Returns void

isButtonDown

  • isButtonDown(btn: Button): boolean
  • Checks if a button is pressed this frame

    Parameters

    Returns boolean

isButtonPressed

  • isButtonPressed(btn: Button): boolean
  • Checks if a button is held down this frame

    Parameters

    Returns boolean

isSoundPlaying

  • isSoundPlaying(src: string): boolean
  • Returns whether a sound file is currently playing

    Parameters

    • src: string

    Returns boolean

playSound

  • playSound(src: string): void
  • Plays an audio file

    Parameters

    • src: string

    Returns void

rect

  • rect(x: number, y: number, width: number, height: number): Rectangle
  • Creates a rectangle

    Parameters

    • x: number
    • y: number
    • width: number
    • height: number

    Returns Rectangle

rgba

  • rgba(r: number, g: number, b: number, a?: number): Color
  • Creates a Color

    Parameters

    • r: number
    • g: number
    • b: number
    • Default value a: number = 255

    Returns Color

run

stopSound

  • stopSound(src: string): void
  • Stops an audio file

    Parameters

    • src: string

    Returns void

vec2

  • vec2(x: number, y: number): Vector2