Releases: phaserjs/phaser
Phaser v3.60 Beta 7
Version 3.60.0 - Miku - in development
New Features - Sprite FX
- When defining the
renderTargets
in a WebGL Pipeline config, you can now set optionalwidth
andheight
properties, which will create a Render Target of that exact size, ignoring thescale
value (if also given). WebGLPipeline.isSpriteFX
is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default isfalse
.GameObjects.Components.FX
is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.fxPadding
and its related methodsetFXPadding
allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.- The
WebGLPipeline.setShader
method has a new optional parameterbuffer
that allows you to set the vertex buffer to be bound before the shader is activated. - The
WebGLPipeline.setVertexBuffer
method has a new optional parameterbuffer
that allows you to set the vertex buffer to be bound if you don't want to bind the default one. - The
WebGLRenderer.createTextureFromSource
method has a new optional boolean parameterforceClamp
that will for the clamp wrapping mode even if the texture is a power-of-two. RenderTarget
will now automatically set the wrapping mode to clamp.WebGLPipeline.flipProjectionMatrix
is a new method that allows you to flip the y and bottom projection matrix values via a parameter.PipelineManager.renderTargets
is a new property that holds an array ofRenderTarget
objects that allSpriteFX
pipelines can share, to keep texture memory as low as possible.PipelineManager.maxDimension
is a new property that holds the largest possible target dimension.PipelineManager.frameInc
is a new property that holds the amount theRenderTarget
s will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.PipelineManager.targetIndex
is a new property that holds the internal target array offset index. Treat it as read-only.- The Pipeline Manager will now create a bunch of
RenderTarget
objects during itsboot
method. These are sized incrementally from 32px and up (use theframeInc
value to alter this). These targets are shared by all Sprite FX Pipelines. PipelineManager.getRenderTarget
is a new method that will return the aRenderTarget
that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.PipelineManager.getSwapRenderTarget
is a new method that will return a 'swap'RenderTarget
that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.PipelineManager.getAltSwapRenderTarget
is a new method that will return a 'alternative swap'RenderTarget
that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
New Features - Compressed Texture Support
Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.
Compressed Textures are loaded using the new this.load.texture
method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.
Development of this feature was kindly sponsored by Club Penguin Rewritten (https://cprewritten.net).
TextureSoure.compressionAlgorithm
is now populated with the compression format used by the texture.Types.Textures.CompressedTextureData
is the new compressed texture configuration object type.TextureManager.addCompressedTexture
is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return aTexture
object than any Sprite can use.Textures.Parsers.KTXParser
is a new parser for the KTX compression container format.Textures.Parsers.PVRParser
is a new parser for the PVR compression container format.- The
WebGLRenderer.compression
property now holds a more in-depth object containing supported compression formats. - The
WebGLRenderer.createTextureFromSource
method now accepts theCompressedTextureData
data objects and creates WebGL textures from them. WebGLRenderer.getCompressedTextures
is a new method that will populate theWebGLRenderer.compression
object and return its value. This is called automatically when the renderer boots.WebGLRenderer.getCompressedTextureName
is a new method that will return a compressed texture format GLenum based on the given format.
New Features - Multi Tint Pipeline
- If you have a customised Multi Tint Pipeline fragment shader that uses the
%forloop%
declaration, you should update it to follow the new format defined inMulti.frag
. This new shader uses a function calledgetSampler
instead. Please see the shader code and update your own shaders accordingly. You can also see the documentation for the MultiPipeline for details. - The
Multi.frag
shader now uses ahighp
precision instead ofmediump
. - The
WebGL.Utils.checkShaderMax
function will no longer use a massive if/else glsl shader check and will instead rely on the value given ingl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)
. - The
WebGL.Utils.parseFragmentShaderMaxTextures
function no longer supports the%forloop%
declaration. - The internal WebGL Utils function
GenerateSrc
has been removed as it's no longer required internally.
New Features - Matter Physics v0.18
We have updated the version of Matter Physics to the latest v0.18 release. This is a big jump and brings with it quite a few internal changes to Matter. The following are the differences we have identified in this release:
- Up to ~40% performance improvement (on average measured over all examples, in Node on a Mac Air M1)
- Replaces
Matter.Grid
with a faster and more efficient broadphase inMatter.Detector
. - Reduced memory usage and garbage collection.
- Resolves issues in
Matter.SAT
related to collision reuse. - Removes performance issues from
Matter.Grid
. - Improved collision accuracy.
MatterPhysics.collision
is a new reference to theCollision
module, which now handles all Matter collision events.MatterPhysics.grid
has been removed as this is now handled by theCollision
module.MatterPhysics.sat
has been removed as this is now handled by theCollision
module.- The
Matter.Body.previousPositionImpulse
property has been removed as it's no longer used.
New Features
ScaleManager.getViewPort
is a new method that will return a Rectangle geometry object that matches the visible area of the screen (thanks @rexrainbow)- When starting a Scene and using an invalid key, Phaser will now raise a console warning informing you of this, instead of silently failing. Fix #5811 (thanks @ubershmekel)
GameObjects.Layer.addToDisplayList
andremoveFromDisplayList
are new methods that allows for you to now add a Layer as a child of another Layer. Fix #5799 (thanks @samme)GameObjects.Video.loadURL
has a new optional 4th parametercrossOrigin
. This allows you to specify a cross origin request type when loading the video cross-domain (thanks @rmartell)- You can now set
loader.imageLoadType: "HTMLImageElement"
in your Game Configuration and the Phaser Loader will use an Image Tag to load all images, rather than XHR and a Blob object which is the default. This is a global setting, so all file types that use images, such as Atlas or Spritesheet, will be changed via this flag (thanks @hanzooo) - You can now control the drawing offset of tiles in a Tileset using the new optional property
Tileset.tileOffset
(which is a Vector2). This property is set automatically when Tiled data is parsed and found to contain it. Fix #5633 (thanks @moJiXiang @kainage) - You can now set the alpha value of the Camera Flash effect before running it, where-as previously it was always 1 (thanks @kainage)
- The
Tilemap.createFromObjects
method has been overhauled to support typed tiles from the Tiled Map Editor (https://doc.mapeditor.org/en/stable/manual/custom-properties/#typed-tiles). It will now also examine the Tileset to inherit properties based on the tile gid. It will also now attempt to use the same texture and frame as Tiled when creating the object (thanks @lackhand) TweenManager.reset
is a new method that will take a tween, remove it from all internal arrays, then seek it back to its start and set it as being active.- The
Video
config will now detect forx-m4v
playback support for video formats and store it in theVideo.m4v
property. This is used automatically by theVideoFile
file loader. Fix #5719 (thanks @patrickkeenan) - The
KeyboardPlugin.removeKey
method has a new optional parameterremoveCapture
. This will remove any keyboard capture events for the given Key. Fix #5693 (thanks @cyantree) - The
KeyboardPlugin.removeAllKeys
method has a new optional parameterremoveCapture
. This will remove any keyboard capture events for all of the Keys owned by the plugin. WebGLShader.fragSrc
is a new property that hold...
Phaser v3.60.0 Beta 6
Version 3.60.0 - Miku - in development
New Features - Sprite FX
- When defining the
renderTargets
in a WebGL Pipeline config, you can now set optionalwidth
andheight
properties, which will create a Render Target of that exact size, ignoring thescale
value (if also given). WebGLPipeline.isSpriteFX
is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default isfalse
.GameObjects.Components.FX
is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.fxPadding
and its related methodsetFXPadding
allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.- The
WebGLPipeline.setShader
method has a new optional parameterbuffer
that allows you to set the vertex buffer to be bound before the shader is activated. - The
WebGLPipeline.setVertexBuffer
method has a new optional parameterbuffer
that allows you to set the vertex buffer to be bound if you don't want to bind the default one. - The
WebGLRenderer.createTextureFromSource
method has a new optional boolean parameterforceClamp
that will for the clamp wrapping mode even if the texture is a power-of-two. RenderTarget
will now automatically set the wrapping mode to clamp.WebGLPipeline.flipProjectionMatrix
is a new method that allows you to flip the y and bottom projection matrix values via a parameter.PipelineManager.renderTargets
is a new property that holds an array ofRenderTarget
objects that allSpriteFX
pipelines can share, to keep texture memory as low as possible.PipelineManager.maxDimension
is a new property that holds the largest possible target dimension.PipelineManager.frameInc
is a new property that holds the amount theRenderTarget
s will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.PipelineManager.targetIndex
is a new property that holds the internal target array offset index. Treat it as read-only.- The Pipeline Manager will now create a bunch of
RenderTarget
objects during itsboot
method. These are sized incrementally from 32px and up (use theframeInc
value to alter this). These targets are shared by all Sprite FX Pipelines. PipelineManager.getRenderTarget
is a new method that will return the aRenderTarget
that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.PipelineManager.getSwapRenderTarget
is a new method that will return a 'swap'RenderTarget
that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.PipelineManager.getAltSwapRenderTarget
is a new method that will return a 'alternative swap'RenderTarget
that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
New Features - Compressed Texture Support
Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.
Compressed Textures are loaded using the new this.load.texture
method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.
Development of this feature was kindly sponsored by Club Penguin Rewritten (https://cprewritten.net).
TextureSoure.compressionAlgorithm
is now populated with the compression format used by the texture.Types.Textures.CompressedTextureData
is the new compressed texture configuration object type.TextureManager.addCompressedTexture
is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return aTexture
object than any Sprite can use.Textures.Parsers.KTXParser
is a new parser for the KTX compression container format.Textures.Parsers.PVRParser
is a new parser for the PVR compression container format.- The
WebGLRenderer.compression
property now holds a more in-depth object containing supported compression formats. - The
WebGLRenderer.createTextureFromSource
method now accepts theCompressedTextureData
data objects and creates WebGL textures from them. WebGLRenderer.getCompressedTextures
is a new method that will populate theWebGLRenderer.compression
object and return its value. This is called automatically when the renderer boots.WebGLRenderer.getCompressedTextureName
is a new method that will return a compressed texture format GLenum based on the given format.
New Features - Multi Tint Pipeline
- If you have a customised Multi Tint Pipeline fragment shader that uses the
%forloop%
declaration, you should update it to follow the new format defined inMulti.frag
. This new shader uses a function calledgetSampler
instead. Please see the shader code and update your own shaders accordingly. You can also see the documentation for the MultiPipeline for details. - The
Multi.frag
shader now uses ahighp
precision instead ofmediump
. - The
WebGL.Utils.checkShaderMax
function will no longer use a massive if/else glsl shader check and will instead rely on the value given ingl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)
. - The
WebGL.Utils.parseFragmentShaderMaxTextures
function no longer supports the%forloop%
declaration. - The internal WebGL Utils function
GenerateSrc
has been removed as it's no longer required internally.
New Features - Matter Physics v0.18
We have updated the version of Matter Physics to the latest v0.18 release. This is a big jump and brings with it quite a few internal changes to Matter. The following are the differences we have identified in this release:
- Up to ~40% performance improvement (on average measured over all examples, in Node on a Mac Air M1)
- Replaces
Matter.Grid
with a faster and more efficient broadphase inMatter.Detector
. - Reduced memory usage and garbage collection.
- Resolves issues in
Matter.SAT
related to collision reuse. - Removes performance issues from
Matter.Grid
. - Improved collision accuracy.
MatterPhysics.collision
is a new reference to theCollision
module, which now handles all Matter collision events.MatterPhysics.grid
has been removed as this is now handled by theCollision
module.MatterPhysics.sat
has been removed as this is now handled by theCollision
module.- The
Matter.Body.previousPositionImpulse
property has been removed as it's no longer used.
New Features
ScaleManager.getViewPort
is a new method that will return a Rectangle geometry object that matches the visible area of the screen (thanks @rexrainbow)- When starting a Scene and using an invalid key, Phaser will now raise a console warning informing you of this, instead of silently failing. Fix #5811 (thanks @ubershmekel)
GameObjects.Layer.addToDisplayList
andremoveFromDisplayList
are new methods that allows for you to now add a Layer as a child of another Layer. Fix #5799 (thanks @samme)GameObjects.Video.loadURL
has a new optional 4th parametercrossOrigin
. This allows you to specify a cross origin request type when loading the video cross-domain (thanks @rmartell)- You can now set
loader.imageLoadType: "HTMLImageElement"
in your Game Configuration and the Phaser Loader will use an Image Tag to load all images, rather than XHR and a Blob object which is the default. This is a global setting, so all file types that use images, such as Atlas or Spritesheet, will be changed via this flag (thanks @hanzooo) - You can now control the drawing offset of tiles in a Tileset using the new optional property
Tileset.tileOffset
(which is a Vector2). This property is set automatically when Tiled data is parsed and found to contain it. Fix #5633 (thanks @moJiXiang @kainage) - You can now set the alpha value of the Camera Flash effect before running it, where-as previously it was always 1 (thanks @kainage)
- The
Tilemap.createFromObjects
method has been overhauled to support typed tiles from the Tiled Map Editor (https://doc.mapeditor.org/en/stable/manual/custom-properties/#typed-tiles). It will now also examine the Tileset to inherit properties based on the tile gid. It will also now attempt to use the same texture and frame as Tiled when creating the object (thanks @lackhand) TweenManager.reset
is a new method that will take a tween, remove it from all internal arrays, then seek it back to its start and set it as being active.- The
Video
config will now detect forx-m4v
playback support for video formats and store it in theVideo.m4v
property. This is used automatically by theVideoFile
file loader. Fix #5719 (thanks @patrickkeenan) - The
KeyboardPlugin.removeKey
method has a new optional parameterremoveCapture
. This will remove any keyboard capture events for the given Key. Fix #5693 (thanks @cyantree) - The
KeyboardPlugin.removeAllKeys
method has a new optional parameterremoveCapture
. This will remove any keyboard capture events for all of the Keys owned by the plugin. WebGLShader.fragSrc
is a new property that hold...
Phaser v3.60.0 Beta 4
Version 3.60.0 - Miku - in development
New Features - Sprite FX
- When defining the
renderTargets
in a WebGL Pipeline config, you can now set optionalwidth
andheight
properties, which will create a Render Target of that exact size, ignoring thescale
value (if also given). WebGLPipeline.isSpriteFX
is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default isfalse
.GameObjects.Components.FX
is a new component that provides access to FX specific properties and methods. The Image and Sprite Game Objects have this component by default.fxPadding
and its related methodsetFXPadding
allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.- The
WebGLPipeline.setShader
method has a new optional parameterbuffer
that allows you to set the vertex buffer to be bound before the shader is activated. - The
WebGLPipeline.setVertexBuffer
method has a new optional parameterbuffer
that allows you to set the vertex buffer to be bound if you don't want to bind the default one. - The
WebGLRenderer.createTextureFromSource
method has a new optional boolean parameterforceClamp
that will for the clamp wrapping mode even if the texture is a power-of-two. RenderTarget
will now automatically set the wrapping mode to clamp.WebGLPipeline.flipProjectionMatrix
is a new method that allows you to flip the y and bottom projection matrix values via a parameter.PipelineManager.renderTargets
is a new property that holds an array ofRenderTarget
objects that allSpriteFX
pipelines can share, to keep texture memory as low as possible.PipelineManager.maxDimension
is a new property that holds the largest possible target dimension.PipelineManager.frameInc
is a new property that holds the amount theRenderTarget
s will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.PipelineManager.targetIndex
is a new property that holds the internal target array offset index. Treat it as read-only.- The Pipeline Manager will now create a bunch of
RenderTarget
objects during itsboot
method. These are sized incrementally from 32px and up (use theframeInc
value to alter this). These targets are shared by all Sprite FX Pipelines. PipelineManager.getRenderTarget
is a new method that will return the aRenderTarget
that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.PipelineManager.getSwapRenderTarget
is a new method that will return a 'swap'RenderTarget
that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.PipelineManager.getAltSwapRenderTarget
is a new method that will return a 'alternative swap'RenderTarget
that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
New Features - Compressed Texture Support
Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.
Compressed Textures are loaded using the new this.load.texture
method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.
Development of this feature was kindly sponsored by Club Penguin Rewritten (https://cprewritten.net).
TextureSoure.compressionAlgorithm
is now populated with the compression format used by the texture.Types.Textures.CompressedTextureData
is the new compressed texture configuration object type.TextureManager.addCompressedTexture
is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return aTexture
object than any Sprite can use.Textures.Parsers.KTXParser
is a new parser for the KTX compression container format.Textures.Parsers.PVRParser
is a new parser for the PVR compression container format.- The
WebGLRenderer.compression
property now holds a more in-depth object containing supported compression formats. - The
WebGLRenderer.createTextureFromSource
method now accepts theCompressedTextureData
data objects and creates WebGL textures from them. WebGLRenderer.getCompressedTextures
is a new method that will populate theWebGLRenderer.compression
object and return its value. This is called automatically when the renderer boots.WebGLRenderer.getCompressedTextureName
is a new method that will return a compressed texture format GLenum based on the given format.
New Features - Multi Tint Pipeline
- If you have a customised Multi Tint Pipeline fragment shader that uses the
%forloop%
declaration, you should update it to follow the new format defined inMulti.frag
. This new shader uses a function calledgetSampler
instead. Please see the shader code and update your own shaders accordingly. You can also see the documentation for the MultiPipeline for details. - The
Multi.frag
shader now uses ahighp
precision instead ofmediump
. - The
WebGL.Utils.checkShaderMax
function will no longer use a massive if/else glsl shader check and will instead rely on the value given ingl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)
. - The
WebGL.Utils.parseFragmentShaderMaxTextures
function no longer supports the%forloop%
declaration. - The internal WebGL Utils function
GenerateSrc
has been removed as it's no longer required internally.
New Features - Matter Physics v0.18
We have updated the version of Matter Physics to the latest v0.18 release. This is a big jump and brings with it quite a few internal changes to Matter. The following are the differences we have identified in this release:
- Up to ~40% performance improvement (on average measured over all examples, in Node on a Mac Air M1)
- Replaces
Matter.Grid
with a faster and more efficient broadphase inMatter.Detector
. - Reduced memory usage and garbage collection.
- Resolves issues in
Matter.SAT
related to collision reuse. - Removes performance issues from
Matter.Grid
. - Improved collision accuracy.
MatterPhysics.collision
is a new reference to theCollision
module, which now handles all Matter collision events.MatterPhysics.grid
has been removed as this is now handled by theCollision
module.MatterPhysics.sat
has been removed as this is now handled by theCollision
module.- The
Matter.Body.previousPositionImpulse
property has been removed as it's no longer used.
New Features
ScaleManager.getViewPort
is a new method that will return a Rectangle geometry object that matches the visible area of the screen (thanks @rexrainbow)- When starting a Scene and using an invalid key, Phaser will now raise a console warning informing you of this, instead of silently failing. Fix #5811 (thanks @ubershmekel)
GameObjects.Layer.addToDisplayList
andremoveFromDisplayList
are new methods that allows for you to now add a Layer as a child of another Layer. Fix #5799 (thanks @samme)GameObjects.Video.loadURL
has a new optional 4th parametercrossOrigin
. This allows you to specify a cross origin request type when loading the video cross-domain (thanks @rmartell)- You can now set
loader.imageLoadType: "HTMLImageElement"
in your Game Configuration and the Phaser Loader will use an Image Tag to load all images, rather than XHR and a Blob object which is the default. This is a global setting, so all file types that use images, such as Atlas or Spritesheet, will be changed via this flag (thanks @hanzooo) - You can now control the drawing offset of tiles in a Tileset using the new optional property
Tileset.tileOffset
(which is a Vector2). This property is set automatically when Tiled data is parsed and found to contain it. Fix #5633 (thanks @moJiXiang @kainage) - You can now set the alpha value of the Camera Flash effect before running it, where-as previously it was always 1 (thanks @kainage)
- The
Tilemap.createFromObjects
method has been overhauled to support typed tiles from the Tiled Map Editor (https://doc.mapeditor.org/en/stable/manual/custom-properties/#typed-tiles). It will now also examine the Tileset to inherit properties based on the tile gid. It will also now attempt to use the same texture and frame as Tiled when creating the object (thanks @lackhand) TweenManager.reset
is a new method that will take a tween, remove it from all internal arrays, then seek it back to its start and set it as being active.- The
Video
config will now detect forx-m4v
playback support for video formats and store it in theVideo.m4v
property. This is used automatically by theVideoFile
file loader. Fix #5719 (thanks @patrickkeenan) - The
KeyboardPlugin.removeKey
method has a new optional parameterremoveCapture
. This will remove any keyboard capture events for the given Key. Fix #5693 (thanks @cyantree) - The
KeyboardPlugin.removeAllKeys
method has a new optional parameterremoveCapture
. This will remove any keyboard capture events for all of the Keys owned by the plugin. WebGLShader.fragSrc
is a new property that hold...
Phaser v3.60.0 Beta 3
Version 3.60.0 - Miku - in development
New Features - Sprite FX
- When defining the
renderTargets
in a WebGL Pipeline config, you can now set optionalwidth
andheight
properties, which will create a Render Target of that exact size, ignoring thescale
value (if also given). WebGLPipeline.isSpriteFX
is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default isfalse
.GameObjects.Components.FX
is a new component that provides access to FX specific propertis and methods. The Image and Sprite Game Objects have this component by default.fxPadding
and its related methodsetFXPadding
allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.- The
WebGLPipeline.setShader
method has a new optional parameterbuffer
that allows you to set the vertex buffer to be bound before the shader is activated. - The
WebGLPipeline.setVertexBuffer
method has a new optional parameterbuffer
that allows you to set the vertex buffer to be bound if you don't want to bind the default one. - The
WebGLRenderer.createTextureFromSource
method has a new optional boolean parameterforceClamp
that will for the clamp wrapping mode even if the texture is a power-of-two. RenderTarget
will now automatically set the wrapping mode to clamp.WebGLPipeline.flipProjectionMatrix
is a new method that allows you to flip the y and bottom projection matrix values via a parameter.PipelineManager.renderTargets
is a new property that holds an array ofRenderTarget
objects that allSpriteFX
pipelines can share, to keep texture memory as low as possible.PipelineManager.maxDimension
is a new property that holds the largest possible target dimension.PipelineManager.frameInc
is a new property that holds the amount theRenderTarget
s will increase in size in each iteration. The default value is 32, meaning it will create targets of size 32, 64, 96, etc. You can control this via the pipeline config object.PipelineManager.targetIndex
is a new property that holds the internal target array offset index. Treat it as read-only.- The Pipeline Manager will now create a bunch of
RenderTarget
objects during itsboot
method. These are sized incrementally from 32px and up (use theframeInc
value to alter this). These targets are shared by all Sprite FX Pipelines. PipelineManager.getRenderTarget
is a new method that will return the aRenderTarget
that best fits the dimensions given. This is typically called by Sprite FX Pipelines, rather than directly.PipelineManager.getSwapRenderTarget
is a new method that will return a 'swap'RenderTarget
that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.PipelineManager.getAltSwapRenderTarget
is a new method that will return a 'alternative swap'RenderTarget
that matches the size of the main target. This is called by Sprite FX pipelines and not typically called directly.
New Features - Compressed Texture Support
Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.
Compressed Textures are loaded using the new this.load.texture
method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, or Multi Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these type of files.
Development of this feature was kindly sponsored by Club Penguin Rewritten (https://cprewritten.net).
TextureSoure.compressionAlgorithm
is now populated with the compression format used by the texture.Types.Textures.CompressedTextureData
is the new compressed texture configuration object type.TextureManager.addCompressedTexture
is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return aTexture
object than any Sprite can use.Textures.Parsers.KTXParser
is a new parser for the KTX compression container format.Textures.Parsers.PVRParser
is a new parser for the PVR compression container format.- The
WebGLRenderer.compression
property now holds a more in-depth object containing supported compression formats. - The
WebGLRenderer.createTextureFromSource
method now accepts theCompressedTextureData
data objects and creates WebGL textures from them. WebGLRenderer.getCompressedTextures
is a new method that will populate theWebGLRenderer.compression
object and return its value. This is called automatically when the renderer boots.WebGLRenderer.getCompressedTextureName
is a new method that will return a compressed texture format GLenum based on the given format.
New Features - Multi Tint Pipeline
- If you have a customised Multi Tint Pipeline fragment shader that uses the
%forloop%
declaration, you should update it to follow the new format defined inMulti.frag
. This new shader uses a function calledgetSampler
instead of the often massive if/else glsl blocks from before. Please see the shader code and update your own shaders accordingly. - The
Multi.frag
shader now uses ahighp
precision instead ofmediump
. - The
WebGL.Utils.checkShaderMax
function will no longer use a massive if/else glsl shader check and will instead rely on the value given ingl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS)
. - The
WebGL.Utils.parseFragmentShaderMaxTextures
function no longer supports the%forloop%
declaration. - The internal WebGL Utils function
GenerateSrc
has been removed as it's no longer required internally.
New Features
ScaleManager.getViewPort
is a new method that will return a Rectangle geometry object that matches the visible area of the screen (thanks @rexrainbow)- When starting a Scene and using an invalid key, Phaser will now raise a console warning informing you of this, instead of silently failing. Fix #5811 (thanks @ubershmekel)
GameObjects.Layer.addToDisplayList
andremoveFromDisplayList
are new methods that allows for you to now add a Layer as a child of another Layer. Fix #5799 (thanks @samme)GameObjects.Video.loadURL
has a new optional 4th parametercrossOrigin
. This allows you to specify a cross origin request type when loading the video cross-domain (thanks @rmartell)- You can now set
loader.imageLoadType: "HTMLImageElement"
in your Game Configuration and the Phaser Loader will use an Image Tag to load all images, rather than XHR and a Blob object which is the default. This is a global setting, so all file types that use images, such as Atlas or Spritesheet, will be changed via this flag (thanks @hanzooo) - You can now control the drawing offset of tiles in a Tileset using the new optional property
Tileset.tileOffset
(which is a Vector2). This property is set automatically when Tiled data is parsed and found to contain it. Fix #5633 (thanks @moJiXiang @kainage) - You can now set the alpha value of the Camera Flash effect before running it, where-as previously it was always 1 (thanks @kainage)
- The
Tilemap.createFromObjects
method has been overhauled to support typed tiles from the Tiled Map Editor (https://doc.mapeditor.org/en/stable/manual/custom-properties/#typed-tiles). It will now also examine the Tileset to inherit properties based on the tile gid. It will also now attempt to use the same texture and frame as Tiled when creating the object (thanks @lackhand)
Updates
- When you try to use a frame that is missing on the Texture, it will now give the key of the Texture in the console warning (thanks @samme)
- The
Display.Masks.BitmapMask
destroy
method will now remove the context-lost event handler. - The
hitArea
parameter of theGameObjects.Zone.setDropZone
method is now optional and if not given it will try to create a hit area based on the size of the Zone Game Object (thanks @rexrainbow) BitmapMask.scene
is a new property that allows the Bitmap Mask to reference the Scene it was created in.- The
DOMElement.preUpdate
method has been removed. If you overrode this method, please now seepreRender
instead. DOMElement.preRender
is a new method that will check parent visibility and improve its behavior, responding to the parent even if the Scene is paused or the element is inactive. Dom Elements are also no longer added to the Scene Update List. Fix #5816 (thanks @prakol16 @samme)- Phaser 3 is now built with webpack 5 and all related packages have been updated.
- Previously, an Array Matrix would enforce it had more than 2 rows. This restriction has been removed, allowing you to define and rotate single-row array matrices (thanks @andriibarvynko)
- The Gamepad objects now have full TypeScript definitions thanks to @sylvainpolletvillard
- Lots of configuration objects now have full TypeScript definitions thanks to @16patsle
Particle.fire
will now throw an error if the particle has no texture frame. This prevents an uncaught error later when the particle fails to render. Fix #5838 (thanks @samme @monteiz)ParticleEmitterManager.setEmitterFrames
will now print out console warnings if an invalid texture frame is given, or if no texture frames were set. Fix #5838 (thanks @samme @monteiz)SceneManager.stop
will now ignore the call if the Sce...
Phaser 3.60.0 Beta 2
Version 3.60.0 - Miku - in development
New Features - Sprite FX
- When defining the
renderTargets
in a WebGL Pipeline config, you can now set optionalwidth
andheight
properties, which will create a Render Target of that exact size, ignoring thescale
value (if also given). WebGLPipeline.isSpriteFX
is a new boolean property that defines if the pipeline is a Sprite FX Pipeline, or not. The default isfalse
.GameObjects.Components.FX
is a new component that provides access to FX specific propertis and methods. The Image and Sprite Game Objects have this component by default.fxPadding
and its related methodsetFXPadding
allow you to set extra padding to be added to the texture the Game Object renders with. This is especially useful for Sprite FX shaders that modify the sprite beyond its bounds, such as glow or shadow effects.- The
WebGLPipeline.setShader
method has a new optional parameterbuffer
that allows you to set the vertex buffer to be bound before the shader is activated. - The
WebGLPipeline.setVertexBuffer
method has a new optional parameterbuffer
that allows you to set the vertex buffer to be bound if you don't want to bind the default one. - The
WebGLRenderer.createTextureFromSource
method has a new optional boolean parameterforceClamp
that will for the clamp wrapping mode even if the texture is a power-of-two. RenderTarget
will now automatically set the wrapping mode to clamp.
New Features - Compressed Texture Support
Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.
Compressed Textures are loaded using the new this.load.texture
method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these.
Development of this feature was kindly sponsored by Club Penguin Rewritten (https://cprewritten.net).
TextureSoure.compressionAlgorithm
is now populated with the compression format used by the texture.Types.Textures.CompressedTextureData
is the new compressed texture configuration object type.TextureManager.addCompressedTexture
is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return aTexture
object than any Sprite can use.Textures.Parsers.KTXParser
is a new parser for the KTX compression container format.Textures.Parsers.PVRParser
is a new parser for the PVR compression container format.- The
WebGLRenderer.compression
property now holds a more in-depth object containing supported compression formats. - The
WebGLRenderer.createTextureFromSource
method now accepts theCompressedTextureData
data objects and creates WebGL textures from them. WebGLRenderer.getCompressedTextures
is a new method that will populate theWebGLRenderer.compression
object and return its value. This is called automatically when the renderer boots.WebGLRenderer.getCompressedTextureName
is a new method that will return a compressed texture format GLenum based on the given format.
New Features
ScaleManager.getViewPort
is a new method that will return a Rectangle geometry object that matches the visible area of the screen (thanks @rexrainbow)- When starting a Scene and using an invalid key, Phaser will now raise a console warning informing you of this, instead of silently failing. Fix #5811 (thanks @ubershmekel)
GameObjects.Layer.addToDisplayList
andremoveFromDisplayList
are new methods that allows for you to now add a Layer as a child of another Layer. Fix #5799 (thanks @samme)GameObjects.Video.loadURL
has a new optional 4th parametercrossOrigin
. This allows you to specify a cross origin request type when loading the video cross-domain (thanks @rmartell)- You can now set
loader.imageLoadType: "HTMLImageElement"
in your Game Configuration and the Phaser Loader will use an Image Tag to load all images, rather than XHR and a Blob object which is the default. This is a global setting, so all file types that use images, such as Atlas or Spritesheet, will be changed via this flag (thanks @hanzooo) - You can now control the drawing offset of tiles in a Tileset using the new optional property
Tileset.tileOffset
(which is a Vector2). This property is set automatically when Tiled data is parsed and found to contain it. Fix #5633 (thanks @moJiXiang @kainage) - You can now set the alpha value of the Camera Flash effect before running it, where-as previously it was always 1 (thanks @kainage)
- The
Tilemap.createFromObjects
method has been overhauled to support typed tiles from the Tiled Map Editor (https://doc.mapeditor.org/en/stable/manual/custom-properties/#typed-tiles). It will now also examine the Tileset to inherit properties based on the tile gid. It will also now attempt to use the same texture and frame as Tiled when creating the object (thanks @lackhand)
Updates
- When you try to use a frame that is missing on the Texture, it will now give the key of the Texture in the console warning (thanks @samme)
- The
Display.Masks.BitmapMask
destroy
method will now remove the context-lost event handler. - The
hitArea
parameter of theGameObjects.Zone.setDropZone
method is now optional and if not given it will try to create a hit area based on the size of the Zone Game Object (thanks @rexrainbow) BitmapMask.scene
is a new property that allows the Bitmap Mask to reference the Scene it was created in.- The
DOMElement.preUpdate
method has been removed. If you overrode this method, please now seepreRender
instead. DOMElement.preRender
is a new method that will check parent visibility and improve its behavior, responding to the parent even if the Scene is paused or the element is inactive. Dom Elements are also no longer added to the Scene Update List. Fix #5816 (thanks @prakol16 @samme)- Phaser 3 is now built with webpack 5 and all related packages have been updated.
- Previously, an Array Matrix would enforce it had more than 2 rows. This restriction has been removed, allowing you to define and rotate single-row array matrices (thanks @andriibarvynko)
- The Gamepad objects now have full TypeScript definitions thanks to @sylvainpolletvillard
- Lots of configuration objects now have full TypeScript definitions thanks to @16patsle
Particle.fire
will now throw an error if the particle has no texture frame. This prevents an uncaught error later when the particle fails to render. Fix #5838 (thanks @samme @monteiz)ParticleEmitterManager.setEmitterFrames
will now print out console warnings if an invalid texture frame is given, or if no texture frames were set. Fix #5838 (thanks @samme @monteiz)SceneManager.stop
will now ignore the call if the Scene has already been shut down, avoiding potential problems with duplicate event handles. Fix #5826 (thanks @samme)- Removed the
Tint
andFlip
components from theCamera
class. Neither were ever used internally, or during rendering, so it was just confusing having them in the API.
Bug Fixes
Animation.createFromAseprite
would calculate an incorrect frame duration if the frames didn't all have the same speed.- The URL scheme
capacitor://
has been added to the protocol check to prevent malformed double-urls in some environments (thanks @consolenaut) - Removed
Config.domBehindCanvas
property as it's never used internally. Fix #5749 (thanks @iamallenchang) dispatchTweenEvent
would overwrite one of the callback's parameters. This fix ensures thatTween.setCallback
now works consistently. Fix #5753 (thanks @andrei-pmbcn @samme)- The context restore event handler is now turned off when a Game Object is destroyed. This helps avoid memory leakage from Text and TileSprite Game Objects, especially if you consistently destroy and recreate your Game instance in a single-page app (thanks @rollinsafary-inomma @rexrainbow @samme)
- When the device does not support WebGL, creating a game with the renderer type set to
Phaser.WEBGL
will now fail with an error. Previously, it would fall back to Canvas. Now it will not fall back to Canvas. If you require that feature, use the AUTO render type. Fix #5583 (thanks @samme) - The
Tilemap.createFromObjects
method will now correctly place both tiles and other objects. Previously, it made the assumption that the origin was 0x1 for all objects, but Tiled only uses this for tiles and uses 0x0 for its other objects. It now handles both. Fix #5789 (thanks @samme) - The
CanvasRenderer.snapshotCanvas
method used an incorrect reference to the canvas, causing the operation to fail. It will now snapshot a canvas correctly. Fix #5792 #5448 (thanks @rollinsafary-inomma @samme @akeboshi1) - The
Tilemap.tileToWorldY
method incorrectly had the parametertileX
. It will worked, but didn't make sense. It is nowtileY
(thanks @mayacoda) - The
Tilemap.convertTilemapLayer
method would fail for isometric tilemaps by not setting the physic body alignment properly. It will now callgetBounds
correctly, allowing for use on non-orthagonal maps. Fix #5764 (thanks @mayacoda) - The
PluginManager.installScenePlugin
method will now check if the plugin is missing from the local keys array and add it back in, if it is (thanks @xiamidaxia) - The Spine Plugin would not work with multiple instances of the same game on a singl...
Phaser 3.60.0 Beta 1
Version 3.60.0 - Miku - in development
New Features - Compressed Texture Support
Phaser 3.60 contains support for Compressed Textures. It can parse both KTX and PVR containers and within those has support for the following formats: ETC, ETC1, ATC, ASTC, BPTC, RGTC, PVRTC, S3TC and S3TCSRB. Compressed Textures differ from normal textures in that their structure is optimized for fast GPU data reads and lower memory consumption. Popular tools that can create compressed textures include PVRTexTool, ASTC Encoder and Texture Packer.
Compressed Textures are loaded using the new this.load.texture
method, which takes a texture configuration object that maps the formats to the files. The browser will then download the first file in the object that it knows it can support. You can also provide Texture Atlas JSON data, too, so you can use compressed texture atlases. Currently, Texture Packer is the best tool for creating these.
TextureSoure.compressionAlgorithm
is now populated with the compression format used by the texture.Types.Textures.CompressedTextureData
is the new compressed texture configuration object type.TextureManager.addCompressedTexture
is a new method that will add a compressed texture, and optionally atlas data into the Texture Manager and return aTexture
object than any Sprite can use.Textures.Parsers.KTXParser
is a new parser for the KTX compression container format.Textures.Parsers.PVRParser
is a new parser for the PVR compression container format.- The
WebGLRenderer.compression
property now holds a more in-depth object containing supported compression formats. - The
WebGLRenderer.createTextureFromSource
method now accepts theCompressedTextureData
data objects and creates WebGL textures from them. WebGLRenderer.getCompressedTextures
is a new method that will populate theWebGLRenderer.compression
object and return its value. This is called automatically when the renderer boots.WebGLRenderer.getCompressedTextureName
is a new method that will return a compressed texture format GLenum based on the given format.
New Features
ScaleManager.getViewPort
is a new method that will return a Rectangle geometry object that matches the visible area of the screen (thanks @rexrainbow)- When starting a Scene and using an invalid key, Phaser will now raise a console warning informing you of this, instead of silently failing. Fix #5811 (thanks @ubershmekel)
GameObjects.Layer.addToDisplayList
andremoveFromDisplayList
are new methods that allows for you to now add a Layer as a child of another Layer. Fix #5799 (thanks @samme)GameObjects.Video.loadURL
has a new optional 4th parametercrossOrigin
. This allows you to specify a cross origin request type when loading the video cross-domain (thanks @rmartell)- You can now set
loader.imageLoadType: "HTMLImageElement"
in your Game Configuration and the Phaser Loader will use an Image Tag to load all images, rather than XHR and a Blob object which is the default. This is a global setting, so all file types that use images, such as Atlas or Spritesheet, will be changed via this flag (thanks @hanzooo) - You can now control the drawing offset of tiles in a Tileset using the new optional property
Tileset.tileOffset
(which is a Vector2). This property is set automatically when Tiled data is parsed and found to contain it. Fix #5633 (thanks @moJiXiang) - You can now set the alpha value of the Camera Flash effect before running it, where-as previously it was always 1 (thanks @kainage)
- The
Tilemap.createFromObjects
method has been overhauled to support typed tiles from the Tiled Map Editor (https://doc.mapeditor.org/en/stable/manual/custom-properties/#typed-tiles). It will now also examine the Tileset to inherit properties based on the tile gid. It will also now attempt to use the same texture and frame as Tiled when creating the object (thanks @lackhand)
Updates
- When you try to use a frame that is missing on the Texture, it will now give the key of the Texture in the console warning (thanks @samme)
- The
Display.Masks.BitmapMask
destroy
method will now remove the context-lost event handler. - The
hitArea
parameter of theGameObjects.Zone.setDropZone
method is now optional and if not given it will try to create a hit area based on the size of the Zone Game Object (thanks @rexrainbow) BitmapMask.scene
is a new property that allows the Bitmap Mask to reference the Scene it was created in.- The
DOMElement.preUpdate
method has been removed. If you overrode this method, please now seepreRender
instead. DOMElement.preRender
is a new method that will check parent visibility and improve its behavior, responding to the parent even if the Scene is paused or the element is inactive. Dom Elements are also no longer added to the Scene Update List. Fix #5816 (thanks @prakol16 @samme)- Phaser 3 is now built with webpack 5 and all related packages have been updated.
- Previously, an Array Matrix would enforce it had more than 2 rows. This restriction has been removed, allowing you to define and rotate single-row array matrices (thanks @andriibarvynko)
- The Gamepad objects now have full TypeScript definitions thanks to @sylvainpolletvillard
- Lots of configuration objects now have full TypeScript definitions thanks to @16patsle
Particle.fire
will now throw an error if the particle has no texture frame. This prevents an uncaught error later when the particle fails to render. Fix #5838 (thanks @samme @monteiz)ParticleEmitterManager.setEmitterFrames
will now print out console warnings if an invalid texture frame is given, or if no texture frames were set. Fix #5838 (thanks @samme @monteiz)SceneManager.stop
will now ignore the call if the Scene has already been shut down, avoiding potential problems with duplicate event handles. Fix #5826 (thanks @samme)
Bug Fixes
Animation.createFromAseprite
would calculate an incorrect frame duration if the frames didn't all have the same speed.- The URL scheme
capacitor://
has been added to the protocol check to prevent malformed double-urls in some environments (thanks @consolenaut) - Removed
Config.domBehindCanvas
property as it's never used internally. Fix #5749 (thanks @iamallenchang) dispatchTweenEvent
would overwrite one of the callback's parameters. This fix ensures thatTween.setCallback
now works consistently. Fix #5753 (thanks @andrei-pmbcn @samme)- The context restore event handler is now turned off when a Game Object is destroyed. This helps avoid memory leakage from Text and TileSprite Game Objects, especially if you consistently destroy and recreate your Game instance in a single-page app (thanks @rollinsafary-inomma @rexrainbow @samme)
- When the device does not support WebGL, creating a game with the renderer type set to
Phaser.WEBGL
will now fail with an error. Previously, it would fall back to Canvas. Now it will not fall back to Canvas. If you require that feature, use the AUTO render type. Fix #5583 (thanks @samme) - The
Tilemap.createFromObjects
method will now correctly place both tiles and other objects. Previously, it made the assumption that the origin was 0x1 for all objects, but Tiled only uses this for tiles and uses 0x0 for its other objects. It now handles both. Fix #5789 (thanks @samme) - The
CanvasRenderer.snapshotCanvas
method used an incorrect reference to the canvas, causing the operation to fail. It will now snapshot a canvas correctly. Fix #5792 #5448 (thanks @rollinsafary-inomma @samme @akeboshi1) - The
Tilemap.tileToWorldY
method incorrectly had the parametertileX
. It will worked, but didn't make sense. It is nowtileY
(thanks @mayacoda) - The
Tilemap.convertTilemapLayer
method would fail for isometric tilemaps by not setting the physic body alignment properly. It will now callgetBounds
correctly, allowing for use on non-orthagonal maps. Fix #5764 (thanks @mayacoda) - The
PluginManager.installScenePlugin
method will now check if the plugin is missing from the local keys array and add it back in, if it is (thanks @xiamidaxia) - The Spine Plugin would not work with multiple instances of the same game on a single page. It now stores its renderer reference outside of the plugin, enabling this. Fix #5765 (thanks @xiamidaxia)
- In Arcade Physics, Group vs. self collisions would cause double collision callbacks due to the use of the quad tree. For this specific conditions, the quad tree is now skipped. Fix #5758 (thanks @samme)
- During a call to
GameObject.Shapes.Rectangle.setSize
it will now correctly update the Rectangle object's display origin and default hitArea (thanks @rexrainbow) - The Arcade Physics Body will now recalculate its center after separation with a Tile in time for the values to be correct in the collision callbacks (thanks @samme)
- The
ParseTileLayers
function has been updated so that it no longer breaks when using a Tiled infinite map with empty chunks (thanks @jonnytest1) - The
PutTileAt
function will now set the Tile dimensions from the source Tileset, fixing size related issues when placing tiles manually. Fix #5644 (thanks @moJiXiang @stuffisthings) - The new
Tileset.tileOffset
property fixes an issue with drawing isometric tiles when an offset had been defined in the map data (thanks @moJiXiang) - Fixed issue in
Geom.Intersects.GetLineToLine
function that would fail with colinear lines (thanks @Skel0t) - The
CameraManager.destroy
function will now remove the Scale ManagerRESIZE
event listener created as part ofboot
, where-as before it didn't clean it up, leading to gc issues. Fix #5791 (thanks @liuhongxuan23) - With
roundPixels
set to true in the game or camera config, Sprites will no longer render at sub-pixel positions under CANVAS. Fix #5774 (thanks @samme) - The Camera will now emit
PRE_RENDER
andPOST_RENDER
events under the Canvas Rend...
Phaser v3.55.2
Phaser v3.55.1
New Features
- The
GameObject.destroy
method has a newfromScene
parameter, set automatically by Phaser. Fix #5716 (thanks @rexrainbow) - The Game Object
DESTROY
event is now set the newfromScene
boolean as the 2nd parameter, allowing you to determine what invoked the event (either user code or a Scene change). Fix #5716 (thanks @rexrainbow)
Bug Fixes
- Fixed an issue with the TypeScript defs not recognising the Game Object Config properly. Fix #5713 (thanks @vforsh)
- Fixed an issue in the
FillPathWebGL
function which caused the filled versions of the Arc, Circle, Ellipse, Polygon and Star Shapes to not render. Fix #5712 (thanks @rexrainbow) - Fixed rendering parameters in
IsoBox
andIsoTriangle
Game Objects that stopped them from rendering correctly. - Added the missing
WebGLPipelineUniformsConfig
type def. Fix #5718 (thanks @PhaserEditor2D)
Phaser v3.55.0
New Features
GameObjects.DOMElement.pointerEvents
is a new property that allows you to set thepointerEvents
attribute on the DOM Element CSS. This isauto
by default and should not be changed unless you know what you're doing.Core.Config.domPointerEvents
is a new config property set viadom: { pointerEvents }
within the Game Config that allows you to set thepointerEvents
css attribute on the DOM Element container.- The
RenderTexture.endDraw
method has a new optional booleanerase
which allows you to draw all objects in the batch using a blend mode of ERASE. This has the effect of erasing any filled pixels in the objects being drawn. - All of the methods from the
GraphicsPipeline
have now been merged with theMultiPipeline
, these includebatchFillRect
,batchFillTriangle
,batchStrokeTriangle
,batchFillPath
,batchStrokePath
andbatchLine
. The Graphics Game Object and all of the Shape Game Objects have been updated to use the new Multi Pipeline. This means that drawing Sprites and Graphics / Shapes will all batch together again. Fix #5553 #5500 (thanks @venarius @roberthook823)
Updates
- The types have been improved for WebGL Compressed Textures (thanks @vforsh)
Container.moveAbove
is a new method that will move a Game Object above another in the same Container (thanks @rexrainbow)Container.moveBelow
is a new method that will move a Game Object below another in the same Container (thanks @rexrainbow)List.moveAbove
is a new method that will move a Game Object above another in the same List (thanks @rexrainbow)List.moveBelow
is a new method that will move a Game Object below another in the same List (thanks @rexrainbow)- The
MeasureText
function, as used by Text Game Objects, has had its performance enhanced by removing a duplicate image data check and also now checks for metrics properties correctly (thanks @valadaptive) WebGLShader.setUniform1
has a new optional boolean parameterskipCheck
which will force the function to set the values without checking against the previously held ones.WebGLShader.setUniform2
has a new optional boolean parameterskipCheck
which will force the function to set the values without checking against the previously held ones.WebGLShader.setUniform3
has a new optional boolean parameterskipCheck
which will force the function to set the values without checking against the previously held ones.WebGLShader.setUniform4
has a new optional boolean parameterskipCheck
which will force the function to set the values without checking against the previously held ones.- The
WebGLShader.set1fv
,set2fv
,set3fv
,set4fv
,set1iv
,set2iv
,set3iv
,set4iv
,setMatrix2fv
,setMatrix3fv
andsetMatrix4fv
methods no longer try to do array comparisons when setting the uniforms, but sets them directly. Fix #5670 (thanks @telinc1)
Bug Fixes
- Have reverted all of the DOM Element CSS changes back to how they were in 3.52, causing both DOM Input and Phaser Input to work together properly again. Fix #5628 (thanks @sacharobarts)
- The
Mesh
Game Object would incorrectly cull faces if the Scene Camera scrolled. It now calculates the cull correctly, regardless of camera world position, zoom or rotation. Fix #5570 (thanks @hendrikras) Math.ToXY
will now return an empty Vector 2 if the index is out of range, where before it would return the input Vector2 (thanks @Trissolo)- The
UpdateList.shutdown
method will now remove thePRE_UPDATE
handler from the ProcessQueue correctly (thanks @samme) - When loading a Video with a config object, it would not get the correct
key
value from it (thanks @mattjennings) - The
GameObjectFactory.existing
method will now acceptLayer
as a TypeScript type. Fix #5642 (thanks @michal-bures) - The
Input.Pointer.event
property can now be aWheelEvent
as well. - Fixed an issue when loading audio files from a Phaser project wrapped in Capacitor native app shell on iOS (thanks @consolenaut)
- Video would not resume playing after regaining focus swapping from another browser tab. Fix #5377 (thanks @spayton)
- Container will now invoke
addToRenderList
before leaving the render method, fixing an issue with Container Input. Fix #5506 (thanks @vforsh @rexrainbow) - The
Game.postBoot
callback was never being invoked due to an incorrect internal property setter. Fix #5689 (thanks @sebastianFast) - The
Light
Game Object didn't set the shader uniforms correctly, causing it to appear to ignore image rotation with normal maps. Fix #5660 (thanks @sroboubi @telinc1)
Examples, Documentation and TypeScript
My thanks to the following for helping with the Phaser 3 Examples, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@x-wk @samme @trynx @Palats @supertorpe @Pixelguy @fractal @halgorithm @golden @H0rn0chse @EmilSV @Patapits @karbassi
Phaser v3.54.0
Version 3.54.0 - Futaro - 26th March 2021
New Features
Phaser.Math.Median
is a new function that will calculate the median of the given values. The values are sorted and the middle value is returned. In case of an even number of values, the average of the two middle values is returned (thanks @vforsh)ScenePlugin.pluginKey
is a new string-based property, set by thePluginManager
that contains the key of the plugin with the Scene Systems.
Updates
- When the Scene-owned Input Plugin is shutdown (i.e. via a call to
Scene.stop
) it will now remove anyKey
objects that the plugin created, not just reset them. This is a quality-of-life breaking change from how it worked previously (thanks @veleek) - Thanks to a TS Parser update by @krotovic the JSDocs can now define
@this
tags. Fix #4669. - The
Scenes.Systems.install
method has been removed. It's no longer required and would throw an error if called. Fix #5580 (thanks @Trissolo) - The
WebAudioSoundManager.onFocus
method will now test to see if the state of theAudioContext
isinterrupted
, as happens on iOS when leaving the page, and then resumes the context. Fix #5390 #5156 #4790 (thanks @SBCGames @micsun-al @AdamXA)
Bug Fixes
- Adding a Game Object to a Container that already existed in another Container would leave a copy of it on the Display List. Fix #5618 (thanks Kromah @mariogarranz)
- Fixed missing
backgroundColor
property in GameConfig. Fix #5597 (thanks @eli-s-r) - BitmapText wouldn't render correctly with the Canvas Renderer when the texture came from a Texture Atlas. Fix #5545 (thanks @vforsh)
- #5504 had broken DOM Elements being able to be clicked due to an oversight of the DOM Container. DOM Elements now correctly pick-up the default pointer events handler. Fix #5594 (thanks @pizkaz)
- The
RGBToString
function will no longer return CSS strings with decimal places if the input contained them (thanks @neil-h) - Objects added to a
SpineContainer
were also added to the base Display List, causing them to appear twice. Fix #5599 (thanks @spayton) - When an Animation has
skipMissedFrames
set it will now bail out of the skip catch-up loop if any of the frames cause the animation to complete. Fix #5620 (thanks @fenrir1990 @Aveyder) - The
Spine Plugin
factory functions now use the local Scene Spine Plugin reference in order to create the objects, rather than the Scene belonging to the first instance of the plugin. This prevents errors when you have globally installed the Spine plugin, but then remove or destroy the first Scene using it (thanks stever1388 @samme)
Examples, Documentation and TypeScript
My thanks to the following for helping with the Phaser 3 Examples, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs: