- Source: src/core/typedefs/index.js (Line 7)
Type Definitions
-
AudioConfig
-
Config object containing various sound settings.
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/AudioConfig.js (Line 1)
- See:
Properties:
Name Type Argument Default Description disableWebAudioboolean <optional>
false Use HTML5 Audio instead of Web Audio.
contextAudioContext <optional>
An existing Web Audio context.
noAudioboolean <optional>
false Disable all audio output.
-
BannerConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/BannerConfig.js (Line 1)
Properties:
Name Type Argument Default Description hidePhaserboolean <optional>
false Omit Phaser's name and version from the banner.
textstring <optional>
'#ffffff' The color of the banner text.
backgroundArray.<string> <optional>
The background colors of the banner.
-
BootCallback(game)
-
Parameters:
Name Type Description gamePhaser.Game The game.
- Since: 3.0.0
- Source: src/core/typedefs/BootCallback.js (Line 1)
-
CallbacksConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/CallbacksConfig.js (Line 1)
Properties:
Name Type Argument Default Description preBootPhaser.Types.Core.BootCallback <optional>
Phaser.Types.Core.NOOP A function to run at the start of the boot sequence.
postBootPhaser.Types.Core.BootCallback <optional>
Phaser.Types.Core.NOOP A function to run at the end of the boot sequence. At this point, all the game systems have started and plugins have been loaded.
-
DOMContainerConfig
-
Type:
- object
- Since: 3.12.0
- Source: src/core/typedefs/DOMContainerConfig.js (Line 1)
Properties:
Name Type Argument Default Description createContainerboolean <optional>
false Should the game create a div element to act as a DOM Container? Only enable if you're using DOM Element objects. You must provide a parent object if you use this feature.
behindCanvasboolean <optional>
false Should the DOM Container that is created (if
dom.createContaineris true) be positioned behind (true) or over the top (false, the default) of the game canvas? -
FPSConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/FPSConfig.js (Line 1)
Properties:
Name Type Argument Default Description minnumber <optional>
5 The minimum acceptable rendering rate, in frames per second.
targetnumber <optional>
60 The optimum rendering rate, in frames per second. This does not enforce the fps rate, it merely tells Phaser what rate is considered optimal for this game.
forceSetTimeOutboolean <optional>
false Use setTimeout instead of requestAnimationFrame to run the game loop.
deltaHistorynumber <optional>
10 Calculate the average frame delta from this many consecutive frame intervals.
panicMaxnumber <optional>
120 The amount of frames the time step counts before we trust the delta values again.
smoothStepboolean <optional>
true Apply delta smoothing during the game update to help avoid spikes?
-
GameConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/GameConfig.js (Line 1)
Properties:
Name Type Argument Default Description widthnumber | string <optional>
1024 The width of the game, in game pixels.
heightnumber | string <optional>
768 The height of the game, in game pixels.
zoomnumber <optional>
1 Simple scale applied to the game canvas. 2 is double size, 0.5 is half size, etc.
typenumber <optional>
CONST.AUTO Which renderer to use. Phaser.AUTO, Phaser.CANVAS, Phaser.HEADLESS, or Phaser.WEBGL. AUTO picks WEBGL if available, otherwise CANVAS.
parentHTMLElement | string <optional>
The DOM element that will contain the game canvas, or its
id. If undefined, or if the named element doesn't exist, the game canvas is appended to the document body. Ifnullno parent will be used and you are responsible for adding the canvas to the dom.canvasHTMLCanvasElement <optional>
null Provide your own Canvas element for Phaser to use instead of creating one.
canvasStylestring <optional>
null CSS styles to apply to the game canvas instead of Phasers default styles.
customEnvironmentboolean <optional>
false Is Phaser running under a custom (non-native web) environment? If so, set this to
trueto skip internal Feature detection. IftruetherenderTypecannot be left asAUTO.contextCanvasRenderingContext2D <optional>
Provide your own Canvas Context for Phaser to use, instead of creating one.
scenePhaser.Scene | Array.<Phaser.Scene> | Phaser.Types.Scenes.SettingsConfig | Array.<Phaser.Types.Scenes.SettingsConfig> | Phaser.Types.Scenes.CreateSceneFromObjectConfig | Array.<Phaser.Types.Scenes.CreateSceneFromObjectConfig> | function | Array.<function()> <optional>
null 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
{ active: true }. See thesceneConfigargument inPhaser.Scenes.SceneManager#add.seedArray.<string> <optional>
Seed for the random number generator.
titlestring <optional>
'' The title of the game. Shown in the browser console.
urlstring <optional>
'http://phaser.io' The URL of the game. Shown in the browser console.
versionstring <optional>
'' The version of the game. Shown in the browser console.
autoFocusboolean <optional>
true Automatically call window.focus() when the game boots. Usually necessary to capture input events if the game is in a separate frame.
inputboolean | Phaser.Types.Core.InputConfig <optional>
Input configuration, or
falseto disable all game input.disableContextMenuboolean <optional>
false Disable the browser's default 'contextmenu' event (usually triggered by a right-button mouse click).
transparentboolean <optional>
false Whether the game canvas will have a transparent background.
bannerboolean | Phaser.Types.Core.BannerConfig <optional>
false Configuration for the banner printed in the browser console when the game starts.
domPhaser.Types.Core.DOMContainerConfig <optional>
The DOM Container configuration object.
fpsPhaser.Types.Core.FPSConfig <optional>
Game loop configuration.
renderPhaser.Types.Core.RenderConfig <optional>
Game renderer configuration.
backgroundColorstring | number <optional>
0x000000 The background color of the game canvas. The default is black.
callbacksPhaser.Types.Core.CallbacksConfig <optional>
Optional callbacks to run before or after game boot.
loaderPhaser.Types.Core.LoaderConfig <optional>
Loader configuration.
imagesPhaser.Types.Core.ImagesConfig <optional>
Images configuration.
physicsPhaser.Types.Core.PhysicsConfig <optional>
Physics configuration.
pluginsPhaser.Types.Core.PluginObject | Array.<Phaser.Types.Core.PluginObjectItem> <optional>
Plugins to install.
scalePhaser.Types.Core.ScaleConfig <optional>
The Scale Manager configuration.
audioPhaser.Types.Core.AudioConfig <optional>
The Audio Configuration object.
pipelinePhaser.Types.Core.PipelineConfig <optional>
A WebGL Pipeline configuration object. Can also be part of the
RenderConfig. -
GamepadInputConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/GamepadInputConfig.js (Line 1)
Properties:
Name Type Argument Default Description target* <optional>
window Where the Gamepad Manager listens for gamepad input events.
-
ImagesConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/ImagesConfig.js (Line 1)
Properties:
Name Type Argument Description defaultstring <optional>
A base64 encoded image file to use as the 'default' texture.
missingstring <optional>
A base64 encoded image file to use as the 'missing' texture.
whitestring <optional>
A base64 encoded image file to use as the 'white' texture.
-
InputConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/InputConfig.js (Line 1)
Properties:
Name Type Argument Default Description keyboardboolean | Phaser.Types.Core.KeyboardInputConfig <optional>
true Keyboard input configuration.
trueuses the default configuration andfalsedisables keyboard input.mouseboolean | Phaser.Types.Core.MouseInputConfig <optional>
true Mouse input configuration.
trueuses the default configuration andfalsedisables mouse input.touchboolean | Phaser.Types.Core.TouchInputConfig <optional>
true Touch input configuration.
trueuses the default configuration andfalsedisables touch input.gamepadboolean | Phaser.Types.Core.GamepadInputConfig <optional>
false Gamepad input configuration.
trueenables gamepad input.activePointersnumber <optional>
1 The maximum number of touch pointers. See Phaser.Input.InputManager#pointers.
smoothFactornumber <optional>
0 The smoothing factor to apply during Pointer movement. See Phaser.Input.Pointer#smoothFactor.
windowEventsboolean <optional>
true Should Phaser listen for input events on the Window? If you disable this, events like 'POINTER_UP_OUTSIDE' will no longer fire.
-
KeyboardInputConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/KeyboardInputConfig.js (Line 1)
Properties:
Name Type Argument Default Description target* <optional>
window Where the Keyboard Manager listens for keyboard input events.
captureArray.<number> <optional>
<nullable>
preventDefaultwill be called on every non-modified key which has a key code in this array. By default it is empty. -
LoaderConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/LoaderConfig.js (Line 1)
Properties:
Name Type Argument Default Description baseURLstring <optional>
A URL used to resolve paths given to the loader. Example: 'http://labs.phaser.io/assets/'.
pathstring <optional>
A URL path used to resolve relative paths given to the loader. Example: 'images/sprites/'.
maxParallelDownloadsnumber <optional>
32 The maximum number of resources the loader will start loading at once.
crossOriginstring | undefined <optional>
'anonymous', 'use-credentials', or
undefined. If you're not making cross-origin requests, leave this asundefined. See https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes.responseTypestring <optional>
The response type of the XHR request, e.g.
blob,text, etc.asyncboolean <optional>
true Should the XHR request use async or not?
userstring <optional>
Optional username for all XHR requests.
passwordstring <optional>
Optional password for all XHR requests.
timeoutnumber <optional>
0 Optional XHR timeout value, in ms.
-
MouseInputConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/MouseInputConfig.js (Line 1)
Properties:
Name Type Argument Default Description target* <optional>
null Where the Mouse Manager listens for mouse input events. The default is the game canvas.
preventDefaultDownboolean <optional>
true If
truethe DOMmousedownevent will havepreventDefaultset.preventDefaultUpboolean <optional>
true If
truethe DOMmouseupevent will havepreventDefaultset.preventDefaultMoveboolean <optional>
true If
truethe DOMmousemoveevent will havepreventDefaultset.preventDefaultWheelboolean <optional>
true If
truethe DOMwheelevent will havepreventDefaultset. -
NOOP()
-
This callback type is completely empty, a no-operation.
- Since: 3.0.0
- Source: src/core/typedefs/NOOP.js (Line 1)
-
PhysicsConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/PhysicsConfig.js (Line 1)
Properties:
Name Type Argument Description defaultstring <optional>
The default physics system. It will be started for each scene. Phaser provides 'arcade', 'impact', and 'matter'.
arcadePhaser.Types.Physics.Arcade.ArcadeWorldConfig <optional>
Arcade Physics configuration.
matterPhaser.Types.Physics.Matter.MatterWorldConfig <optional>
Matter Physics configuration.
-
PipelineConfig
-
Type:
- object
- Since: 3.50.0
- Source: src/core/typedefs/PipelineConfig.js (Line 1)
Properties:
Name Type Description namestring The name of the pipeline. Must be unique within the Pipeline Manager.
pipelinePhaser.Renderer.WebGL.WebGLPipeline The pipeline class. This should be a constructable object, not an instance of a class.
-
PluginObject
-
Type:
- object
- Since: 3.8.0
- Source: src/core/typedefs/PluginObject.js (Line 1)
Properties:
Name Type Argument Description globalArray.<Phaser.Types.Core.PluginObjectItem> <optional>
<nullable>
Global plugins to install.
sceneArray.<Phaser.Types.Core.PluginObjectItem> <optional>
<nullable>
Scene plugins to install.
defaultArray.<string> <optional>
The default set of scene plugins (names).
defaultMergeArray.<string> <optional>
Plugins to add to the default set of scene plugins.
-
PluginObjectItem
-
Type:
- object
- Since: 3.8.0
- Source: src/core/typedefs/PluginObjectItem.js (Line 1)
Properties:
Name Type Argument Description keystring <optional>
A key to identify the plugin in the Plugin Manager.
plugin* <optional>
The plugin itself. Usually a class/constructor.
startboolean <optional>
Whether the plugin should be started automatically.
systemKeystring <optional>
For a scene plugin, add the plugin to the scene's systems object under this key (
this.sys.KEY, from the scene).sceneKeystring <optional>
For a scene plugin, add the plugin to the scene object under this key (
this.KEY, from the scene).mappingstring <optional>
If this plugin is to be injected into the Scene Systems, this is the property key map used.
data* <optional>
Arbitrary data passed to the plugin's init() method.
Examples
// Global plugin { key: 'BankPlugin', plugin: BankPluginV3, start: true, data: { gold: 5000 } }// Scene plugin { key: 'WireFramePlugin', plugin: WireFramePlugin, systemKey: 'wireFramePlugin', sceneKey: 'wireframe' } -
RenderConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/RenderConfig.js (Line 1)
Properties:
Name Type Argument Default Description antialiasboolean <optional>
true When set to
true, WebGL uses linear interpolation to draw scaled or rotated textures, giving a smooth appearance. When set tofalse, WebGL uses nearest-neighbor interpolation, giving a crisper appearance.falsealso disables antialiasing of the game canvas itself, if the browser supports it, when the game canvas is scaled.antialiasGLboolean <optional>
true Sets the
antialiasproperty when the WebGL context is created. Setting this value does not impact any subsequent textures that are created, or the canvas style attributes.desynchronizedboolean <optional>
false When set to
trueit will create a desynchronized context for both 2D and WebGL. See https://developers.google.com/web/updates/2019/05/desynchronized for details.pixelArtboolean <optional>
false Sets
antialiasto false androundPixelsto true. This is the best setting for pixel-art games.roundPixelsboolean <optional>
false Draw texture-based Game Objects at only whole-integer positions. Game Objects without textures, like Graphics, ignore this property.
transparentboolean <optional>
false 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.
clearBeforeRenderboolean <optional>
true Whether the game canvas will be cleared between each rendering frame.
premultipliedAlphaboolean <optional>
true In WebGL mode, the drawing buffer contains colors with pre-multiplied alpha.
failIfMajorPerformanceCaveatboolean <optional>
false Let the browser abort creating a WebGL context if it judges performance would be unacceptable.
powerPreferencestring <optional>
'default' "high-performance", "low-power" or "default". A hint to the browser on how much device power the game might use.
batchSizenumber <optional>
4096 The default WebGL batch size. Represents the number of quads that can be added to a single batch.
maxLightsnumber <optional>
10 The maximum number of lights allowed to be visible within range of a single Camera in the LightManager.
maxTexturesnumber <optional>
-1 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.
mipmapFilterstring <optional>
'LINEAR' The mipmap magFilter to be used when creating WebGL textures.
piplinePhaser.Types.Core.PipelineConfig <optional>
The WebGL Pipeline configuration object.
-
ScaleConfig
-
Type:
- object
- Since: 3.16.0
- Source: src/core/typedefs/ScaleConfig.js (Line 1)
Properties:
Name Type Argument Default Description widthnumber | string <optional>
1024 The base width of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size.
heightnumber | string <optional>
768 The base height of your game. Can be an integer or a string: '100%'. If a string it will only work if you have set a parent element that has a size.
zoomPhaser.Scale.ZoomType | number <optional>
1 The zoom value of the game canvas.
parentHTMLElement | string <optional>
<nullable>
The DOM element that will contain the game canvas, or its
id. If undefined, or if the named element doesn't exist, the game canvas is inserted directly into the document body. Ifnullno parent will be used and you are responsible for adding the canvas to your environment.expandParentboolean <optional>
true Is the Scale Manager allowed to adjust the CSS height property of the parent and/or document body to be 100%?
modePhaser.Scale.ScaleModeType <optional>
Phaser.Scale.ScaleModes.NONE The scale mode.
minWidthHeight <optional>
The minimum width and height the canvas can be scaled down to.
maxWidthHeight <optional>
The maximum width the canvas can be scaled up to.
autoRoundboolean <optional>
false Automatically round the display and style sizes of the canvas. This can help with performance in lower-powered devices.
autoCenterPhaser.Scale.CenterType <optional>
Phaser.Scale.Center.NO_CENTER Automatically center the canvas within the parent?
resizeIntervalnumber <optional>
500 How many ms should elapse before checking if the browser size has changed?
fullscreenTargetHTMLElement | string <optional>
<nullable>
The DOM element that will be sent into full screen mode, or its
id. If undefined Phaser will create its own div and insert the canvas into it when entering fullscreen mode. -
TimeStepCallback(time, average, interpolation)
-
Parameters:
Name Type Description timenumber The current time. Either a High Resolution Timer value if it comes from Request Animation Frame, or Date.now if using SetTimeout.
averagenumber The Delta Average.
interpolationnumber Interpolation - how far between what is expected and where we are?
- Since: 3.0.0
- Source: src/core/typedefs/TimeStepCallback.js (Line 1)
-
TouchInputConfig
-
Type:
- object
- Since: 3.0.0
- Source: src/core/typedefs/TouchInputConfig.js (Line 1)
Properties:
Name Type Argument Default Description target* <optional>
null Where the Touch Manager listens for touch input events. The default is the game canvas.
captureboolean <optional>
true Whether touch input events have preventDefault() called on them.
-
WidthHeight
-
Type:
- object
- Since: 3.16.0
- Source: src/core/typedefs/WidthHeight.js (Line 1)
Properties:
Name Type Argument Default Description widthnumber <optional>
0 The width.
heightnumber <optional>
0 The height.
