Gleam - v1.0.2
    Preparing search index...

    Class Settings

    Engine-wide configuration. A static-class singleton — read/write top-level fields directly (Settings.fps = 1 / 30). Initialised once via init from Game's constructor; calling init twice throws.

    Index

    Constructors

    Properties

    antialias: boolean = false

    Enable smoothing on the main canvas context. Default false for crisp pixel art.

    autoloop: boolean = true

    Start the gameloop automatically after init() resolves. Disable to drive gameloop.startLoop() manually. Default true.

    backgroundColor: string = "#444"

    CSS color used when useClearRect is false. Default "#444".

    debug: boolean = false

    Debug mode: assigns the Game instance to window.game and lets Keyboard Escape stop the loop. Default false.

    doNotClear: boolean = false

    Skip the per-frame canvas clear. Use for trail/decay effects where you manage clearing yourself. Default false.

    enableResize: boolean = true

    Stretch the main canvas to fill the window on resize while preserving its aspect ratio. Default true.

    font: string = "Arial"

    Default font family for canman.setFontSize. Default "Arial".

    fps: number = ...

    Seconds per fixed step, not frames per second — 1 / 60 = 60 Hz, 1 / 30 = 30 Hz. Must be finite and > 0 or init throws.

    triedToClose?: () => void

    Callback invoked from the beforeunload handler when warnBeforeClose is true. Useful for "are you sure?" autosave logic.

    useClearRect: boolean = true

    Clear the canvas with clearRect (transparent) when true, or fillRect with backgroundColor when false. Default true.

    warnBeforeClose: boolean = false

    Show a browser "are you sure?" dialog on tab close. Required for triedToClose to fire. Default false.

    Accessors

    • get localStorage(): Readonly<typeof Settings._localStorage>

      Read-only view of the persisted localStorage blob. Writes go through setLocalStorage.

      Returns Readonly<typeof Settings._localStorage>

    Methods

    • One-time setup — called by Game's constructor with the overrides passed to super(). Validates fps, loads the persisted localStorage blob, derives language from navigator.language, and wires the close-warning handler if warnBeforeClose. Throws if called twice or if fps isn't a finite positive number.

      Parameters

      Returns void

    • Typed setter for the persisted localStorage blob. Writes both in-memory and to actual localStorage (under a single JSON key — "gleam"). The only supported way to mutate persisted state.

      Type Parameters

      • K extends "language"

      Parameters

      • key: K
      • value: { language: string }[K]

      Returns void