Game
Creates a new Phaser.Game instance
Props
Name | Type | Default | Description |
---|---|---|---|
antialias | boolean | When set to | |
antialiasGL | boolean | Sets the | |
audio | AudioConfig | The Audio Configuration object. | |
autoFocus | boolean | Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame. | |
backgroundColor | string number | The background color of the game canvas. The default is black. | |
banner | boolean BannerConfig | Configuration for the banner printed in the browser console when the game starts. | |
batchSize | number | The default WebGL batch size. Represents the number of quads that can be added to a single batch. | |
callbacks | CallbacksConfig | Optional callbacks to run before or after game boot. | |
canvas | HTMLCanvasElement | Provide your own Canvas element for Phaser to use instead of creating one. | |
canvasStyle | string | CSS styles to apply to the game canvas instead of Phasers default styles. | |
clearBeforeRender | boolean | Whether the game canvas will be cleared between each rendering frame. | |
context | CanvasRenderingContext2D | Provide your own Canvas Context for Phaser to use, instead of creating one. | |
customEnvironment | boolean | Is Phaser running under a custom (non-native web) environment? If so, set this to | |
desynchronized | boolean | When set to | |
disableContextMenu | boolean | Disable the browser’s default ‘contextmenu’ event (usually triggered by a right-button mouse click). | |
dom | DOMContainerConfig | The DOM Container configuration object. | |
failIfMajorPerformanceCaveat | boolean | Let the browser abort creating a WebGL context if it judges performance would be unacceptable. | |
fps | FPSConfig | Game loop configuration. | |
height | string number | The height of the game, in game pixels. | |
images | ImagesConfig | Images configuration. | |
input | boolean InputConfig | Input configuration, or | |
loader | LoaderConfig | Loader configuration. | |
maxLights | number | The maximum number of lights allowed to be visible within range of a single Camera in the LightManager. | |
maxTextures | number | When in WebGL mode, this sets the maximum number of GPU Textures to use. The default, -1, will use all available units. The WebGL1 spec says all browsers should provide a minimum of 8. | |
mipmapFilter | string | The mipmap magFilter to be used when creating WebGL textures. | |
parent | string HTMLElement | The DOM element that will contain the game canvas, or its | |
physics | PhysicsConfig | Physics configuration. | |
pipeline | PipelineConfig | A WebGL Pipeline configuration object. Can also be part of the | |
pixelArt | boolean | Sets | |
plugins | PluginObject PluginObjectItem[] | Plugins to install. | |
powerPreference | string | “high-performance”, “low-power” or “default”. A hint to the browser on how much device power the game might use. | |
premultipliedAlpha | boolean | In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha. | |
preserveDrawingBuffer | boolean | If the value is true the WebGL buffers will not be cleared and will preserve their values until cleared or overwritten by the author. | |
ref | Ref |
| |
render | RenderConfig | Game renderer configuration. | |
roundPixels | boolean | Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property. | |
scale | ScaleConfig | The Scale Manager configuration. | |
scene | Function Scene Scene[] SettingsConfig SettingsConfig[] CreateSceneFromObjectConfig CreateSceneFromObjectConfig[] Function[] | A scene or scenes to add to the game. If several are given, the first is started; the remainder are started only if they have | |
seed | string[] | Seed for the random number generator. | |
title | string | The title of the game. Shown in the browser console. | |
transparent | boolean | Whether the game canvas will be transparent. Boolean that indicates if the canvas contains an alpha channel. If set to false, the browser now knows that the backdrop is always opaque, which can speed up drawing of transparent content and images. | |
type | number | Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS. | |
url | string | The URL of the game. Shown in the browser console. | |
version | string | The version of the game. Shown in the browser console. | |
width | string number | The width of the game, in game pixels. | |
zoom | number | Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc. |