Application.Settings
typedef Settings
object
Application & Renderer Settings definition.
Summary
Properties from Settings
boolean |
|
HTMLCanvasElement |
|
boolean |
|
"sorting" | "z-buffer" |
|
string | HTMLElement |
|
"default" | "high-performance" | "low-power" |
|
boolean |
|
number | Renderer |
|
number | string |
|
"fit" | "fill-min" | "fill-max" | "flex" | "flex-width" | "flex-height" | "stretch" |
|
string | HTMLElement |
|
boolean |
|
Public Properties
static antiAlias: boolean = false
boolean
whether to enable or not video scaling interpolation
static canvas: HTMLCanvasElement
HTMLCanvasElement
an existing canvas element to use as the renderer target (by default melonJS will create its own canvas based on given parameters)
static consoleHeader: boolean = true
boolean
whether to display melonJS version and basic device information in the console
static depthTest: "sorting" | "z-buffer" = "sorting"
"sorting" | "z-buffer"
~Experimental~ the default method to sort object on the z axis in WebGL
static parent: string | HTMLElement = document.body
string | HTMLElement
the DOM parent element to hold the canvas in the HTML file
static powerPreference: "default" | "high-performance" | "low-power" = "default"
"default" | "high-performance" | "low-power"
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.
static preferWebGL1: boolean = false
boolean
if true the renderer will only use WebGL 1
static renderer: number | Renderer = AUTO
number | Renderer
renderer to use (CANVAS, WEBGL, AUTO), or a custom renderer class
static scale: number | string = 1.0
number | string
enable scaling of the canvas ('auto' for automatic scaling)
static scaleMethod: "fit" | "fill-min" | "fill-max" | "flex" | "flex-width" | "flex-height" | "stretch" = "fit"
"fit" | "fill-min" | "fill-max" | "flex" | "flex-width" | "flex-height" | "stretch"
screen scaling modes :
fit
: Letterboxed; content is scaled to design aspect ratio
- `fill-min` : Canvas is resized to fit minimum design resolution; content is scaled to design aspect ratio
- `fill-max` : Canvas is resized to fit maximum design resolution; content is scaled to design aspect ratio
- `flex`< : Canvas width & height is resized to fit; content is scaled to design aspect ratio
- `flex-width` : Canvas width is resized to fit; content is scaled to design aspect ratio
- `flex-height` : Canvas height is resized to fit; content is scaled to design aspect ratio
- `stretch` : Canvas is resized to fit; content is scaled to screen aspect ratio
static scaleTarget: string | HTMLElement
string | 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)
static transparent: boolean = false
boolean
whether to allow transparent pixels in the front buffer (screen).