melonJS
    Preparing search index...

    Type Alias ApplicationSettings

    ApplicationSettings: {
        antiAlias: boolean;
        backgroundColor: string;
        batcher?: new (renderer: any) => Batcher;
        blendMode: BlendMode;
        compositor?: new (renderer: any) => Batcher;
        consoleHeader: boolean;
        failIfMajorPerformanceCaveat: boolean;
        highPrecisionShader: boolean;
        legacy: boolean;
        physic: PhysicsType;
        powerPreference: PowerPreference;
        preferWebGL1: boolean;
        renderer: RendererType | Renderer;
        scale: number | "auto";
        scaleMethod: ScaleMethod;
        scaleTarget: HTMLElement;
        subPixel: boolean;
        transparent: boolean;
        verbose: boolean;
    } & (
        | { canvas?: never; parent: string
        | HTMLElement }
        | { canvas: HTMLCanvasElement; parent?: never }
    )

    Type Declaration

    • antiAlias: boolean

      whether to enable or not video scaling interpolation

      false
      
    • backgroundColor: string

      the CSS background color of the parent element that holds the canvas. Applied during initialization to prevent a white flash before the first render. Set to "transparent" to disable, or any valid CSS color value.

      "#000000"
      
    • Optionalbatcher?: new (renderer: any) => Batcher

      a custom batcher class (WebGL only)

    • blendMode: BlendMode

      the default blend mode to use ("normal", "multiply", "lighter", "additive", "screen")

      "normal"
      
    • Optionalcompositor?: new (renderer: any) => Batcher

      a custom batcher class (WebGL only)

      since 18.1.0 — use batcher instead

    • consoleHeader: boolean

      whether to display melonJS version and basic device information in the console

      true
      
    • failIfMajorPerformanceCaveat: boolean

      if true, the renderer will fail if the browser reports a major performance caveat (e.g. software WebGL). Set to false to allow WebGL on machines with blocklisted GPU drivers or software renderers.

      true
      
    • highPrecisionShader: boolean

      enable high precision shaders (WebGL only). When false, shaders prefer "mediump" precision for better performance on some mobile GPUs, falling back to "lowp" if "mediump" is not supported. When true (default), the highest precision supported by the device is used. This setting is ignored by the Canvas renderer.

      true
      
      import { Application, device } from "melonjs";
      const app = new Application(800, 600, {
      parent: "screen",
      // prefer lower shader precision on mobile for better performance
      highPrecisionShader: !device.isMobile,
      });
    • legacy: boolean

      whether to enable legacy mode (enables deprecated video.init() entry point)

      false
      
    • physic: PhysicsType

      the physic system to use (default: "builtin", or "none" to disable builtin physic)

      "builtin"
      
    • powerPreference: PowerPreference

      a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context. To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.

      default
      
    • preferWebGL1: boolean

      if true the renderer will only use WebGL 1

      false
      
    • renderer: RendererType | Renderer

      renderer to use (CANVAS, WEBGL, AUTO), or a custom renderer class

      AUTO
      
    • scale: number | "auto"

      enable scaling of the canvas ('auto' for automatic scaling)

      1
      
    • scaleMethod: ScaleMethod

      screen scaling modes

      "manual"
      
    • scaleTarget: HTMLElement

      the HTML Element to be used as the reference target when using automatic scaling (by default melonJS will use the parent container of the div element containing the canvas)

    • subPixel: boolean

      whether to enable sub-pixel rendering (avoid sprite flickering when using transforms)

      false
      
    • transparent: boolean

      whether to allow transparent pixels in the front buffer (screen).

      false
      
    • verbose: boolean

      whether to enable verbose mode (additional console output for debugging)

      false
      
    • { canvas?: never; parent: string | HTMLElement }
      • Optionalcanvas?: never
      • parent: string | HTMLElement

        the DOM parent element (or its string ID) to hold the canvas in the HTML file

    • { canvas: HTMLCanvasElement; parent?: never }
      • canvas: HTMLCanvasElement

        an existing canvas element to use as the renderer target (by default melonJS will create its own canvas based on given parameters)

      • Optionalparent?: never