Phaser v3.85.0 Beta 2 #6873
photonstorm
announced in
Announcements
Replies: 1 comment
-
The updates to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version 3.85.0 - Itsuki - in development
Round Pixels
Includes a Potentially Breaking Change
The way
roundPixels
has been handled in this release has been changed significantly. In previous versions we passed a uniform to the shaders and handled the pixel rounding on the GPU. However, this caused issues with our batching flow - for example, a Sprite would need to be rounded, but a Text or Shape object would not. This lead to complications in some parts of the render code.In this release we have removed the shader uniform and branching and also made
roundPixels
default tofalse
in the Game Config. Previously, it wastrue
, so you may need to switch this flag if you were relying on it. Here are the results of this change:roundPixels
property now defaults tofalse
.uRoundPixels
uniform has been removed from the Single, Multi and Mobile vertex shaders.uRoundPixels
uniform has been removed from the Single, Rope, PreFX, PostFX, Multi and Mobile WebGL Pipelines.camera.roundPixels
value to the Transform MatrixsetQuad
method.batchSprite
andbatchTexture
methods will now applyMath.floor
to the sprite matrix calculations if camera round pixels is enabled.BaseCamera.preRender
has been removed. This method was completely overridden byCamera.preRender
which is the method that contained the correct rendering logic. As the Base Camera variant was not used internally outside of Dynamic Textures, we have removed it to save space.Camera.preRender
has been updated to use both zoomX and zoomY for the matrix transform.Camera.preRender
has been updated to apply Math.floor to the scroll factor when rounding is enabled on the Camera. This fixes an issue where following sprites with Camera lerp, or heavy zoom factors, would cause 'stuttering' at sub-pixel values.New Features
BaseSoundManager.isPlaying
is a new method that will return a boolean if the given sound key is playing. If you don't provide a key, it will return a boolean if any sound is playing (thanks @samme)WebGLRenderer.dispatchContextLost
is a new internal method that is called when the WebGL context is lost. By default this is bound to the propertyWebGLRenderer.contextLostHandler
. If you override the context loss handler, be sure to invoke this method in due course.WebGLRenderer.dispatchContextRestore
is a new internal method that is called when the WebGL context is restored. By default this is bound to the propertyWebGLRenderer.contextRestoreHandler
. If you override the context restore handler, be sure to invoke this method in due course.WebGLRenderer.setContextHandlers
is a new internal method with 2 optional parameters:contextLost
andcontextRestored
. These allow you to overwrite the defaultcontextLostHandler
andcontextRestoreHandler
handlers. (thanks @yaustar)Phaser.Textures.Frame#setCutPosition
is a new internal method with 2 optional parameters:x
andy
. These sets the x and y position within the source image to cut from.Phaser.Textures.Frame#setCutSize
is a new internal method with 2 parameters:width
andheight
. These sets the width, and height of the area in the source image to cut. (thanks @FelipeIzolan)ORIENTATION_CONST
. The constantsLANDSCAPE_SECONDARY
andPORTRAIT_SECONDARY
have been added to thePhaser.Scale.Orientation
object. These constants represent the secondary landscape and portrait orientations respectively. This addition provides more granular control over device orientation handling in Phaser. Fix scaleManager.isPortrait and scaleManager.isLandscape #6837 (thanks @rexrainbow)updateConfig
method inParticleEmitter
to allow dynamic updating of Particle Emitter configurations. This method enables existing properties to be overridden and new properties to be added to the emitter's configuration. It ensures that the emitter is reset with the updated configuration for more flexible particle effects management.wrap
method has been natively integrated into theBody
class to replace the existingMatterWrap
plugin. Here's how it works.attractors
plugin has been natively integrated into theBody
class and Matter engine. More details here.Phaser.Textures.DynamicTexture#clear
method. Clear a specific area within aDynamic Texture
by specifyingx
,y
,width
, andheight
parameters to clear only a portion of the texture. Fix Textures should have a way toerase
a portion of the texture via a size / width / height #6853 (thanks @SelfDevTV)Phaser.Renderer.WebGL.RenderTarget#clear
method. Clear a specific area within theRenderTarget
by specifyingx
,y
,width
, andheight
parameters.TextureManager
. In the gameconfig
, setdefaultImage
tonull
to ignore loading thedefaultImage
.TextureManager
. In the gameconfig
, setmissingImage
tonull
to ignore loading themissingImage
.TextureManager
. In the gameconfig
, setwhiteImage
tonull
to ignore loading thewhiteImage
.Phaser.Core.TimeStep#pauseDuration
is a new property that holds the duration of the most recent game pause, if any, in ms (thanks @samme)Events#RESUME
event now contains a new parameterpauseDuration
which is the duration, in ms, that the game was paused for (thanks @samme)Phaser.Loader.LoaderPlugin#removePack
method toLoaderPlugin
that removes resources listed in an Asset Pack.(thanks @samme)WebGL Rendering Updates
WebGLTextureWrapper.update
expanded:source
parameter is now type?object
, so it can be used for anything that is valid in the constructor.format
parameter can update the texture format.Updates
MatterCollisionEvents
plugin functionality directly into theMatter.World
class to handle collisions more effectively. More details here.Matter.World
to improve the performance, accuracy, and reliability of theupdate
method in handling physics simulations or animations. More details here.Timeline.pause
will now pause any currently active Tweens that the Timeline had started (thanks @monteiz)Timeline.resume
will now resume any currently paused Tweens that the Timeline had started (thanks @monteiz)Timeline.clear
andTimeline.destroy
will now destroy any currently active Tweens that the Timeline had created. Previously, active tweens would continue to play to completion (thanks @monteiz)TimelineEvent
has a new property calledtweenInstance
. If the Timeline event has a tween that has been activated, this will hold a reference to it.requestVideoFrame
polyfill has been updated to the latest release, which should resolve some SSR framework issues. Fix requestVideoFrame polyfill is causing a error in Next.js hot-reload #6776 (thanks @lantictac)ScaleManager
listeners includes checks for thescreen.orientation
object and adds/removes achange
eventListener method to handle screen orientation changes on mobile devices. Theorientationchange
event is still maintained for backwards compatibility. Fix scaleManager.isPortrait and scaleManager.isLandscape #6837 (thanks @rexrainbow)TileSprite
, setting eitherwidth
orheight
to0
results in both values being set to thedisplayFrame.width
anddisplayFrame.height
. The updated logic now checks forwidth
andheight
separately. Ifwidth
is0
, it is set todisplayFrame.width
. Ifheight
is0
, it is set todisplayFrame.height
. Fix Tilesprite width / height not respected one dimension is zero #6857 (thanks @GaryStanton)GetBitmapTextSize
with improvedmaxWidth
calculations for wrapped text.Vector3.subVectors
is a new method that will take 2 Vector3s, subtract them from each other and store the result in the Vector3 it was called on.TextStyle.setStyle
method will no longer mutate the givenstyle
object if it includes a numericfontSize
value. Fix TextStyle.setStyle mutates the given style parameter object #6863 (thanks @stormpanda)Shape.Ellipse.setSize
method will internally callupdateDisplayOrigin
to retain position after a size change.BitmapText BatchChar
function now inlines all of the matrix math, avoiding 16 function calls per character rendered.Bug Fixes
activePointers
game config option is now the correct amount of touch input pointers set. Fix The last touch input pointer is never activated #6783 (thanks @samme)TextureManager.checkKey
will now returnfalse
if the key is not a string, which fixes issues where a texture could be created if a key was given that was already in use (thanks Will Macfarlane).imageLoadType
) to LoaderConfig, so they now appear in the TypeScript defs.EXPAND
scale mode had a bug that prevented it from using the world bounds cameras, cutting rendering short. Fix EXPAND falls back to config width and height when changing scenes #6767 (thanks @Calcue-dev @rexrainbow)getPipelineName()
on a Game Object would cause a runtime error if running under Canvas. It now simply returnsnull
. FixgetPipelineName()
errors with the Canvas renderer #6799 (thanks @samme)setPushable(false)
method forcircle
bodies prevents the bodies from being pushed. Fix Pushablefalse
bodies still move when circle shaped #5617 (thanks @kainage)addDeathZone()
on a particle emitter Game Object had a bug where theDeathZone
used world position coordinates.DeathZone
now uses local position coordinates following the particle emitter position. Fix Particle emitter death zones are positioned in global space #6371 (thanks @vforsh)GetLineToLine
method inGetLineToLine
to handle the case wheredx1
ordy1
values is zero. This ensures the function correctly returnsnull
in this case to prevent errors in calculations involving line segments. Fix The result will be NaN, if dx1===0 (GetLineToLine.js) #6579 (thanks @finscn)Matter.World
bug wheregroup.length
returnsundefined
. Changed togroup.getLength()
to correctly return number of children in a group.&
operation betweenbody1.collisionMask
andbody2.collisionCategory
. The defaultcollisionMask
value is changed to2147483647
to correctly match anycollisionCategory
. Fix Group vs Group collisions fail if child objects have non-default masks or categories because the default collisionMask only matches the category "1". #6764 (thanks @codeimpossible)BitmapText
where adding a space character' '
at the end of a line did not correctly align the vertical position of the new line. The updated calculation now correctly accounts for both line height and line spacing. Fix a problem with the bitmap text when the maxWidth is set and the last letter is space #6717 (thanks @wooseok123)BitmapText
where an extra empty line was added whensetMaxWidth
was called, and the width of the line was less than a word. Previously,yAdvance
was incorrectly incremented bylineHeight + lineSpacing
for each word, leading to an unintended increase in vertical space. The correction now calculatesyAdvance
based on thecurrentLine
index, ensuring that vertical spacing accurately reflects the number of lines. Fix BitmapText setMaxWidth() bug #6807 (thanks @AlvaroNeuronup)BitmapText
where adding a space character' '
at the end of a line caused the following line of to ignore line wrapping when usingsetMaxWidth
. Fix BitmapText not wrapping lines in some cases #6860 (thanks @bagyoni)Matrix4.lookAtRH
method would fail because it called two missing Vector3 methods.RenderTarget
will now automatically listen for the Renderer resize event ifautoResize
is true. This fixes an issue with Bitmap Masks where they wouldn't resize if the renderer resized. Fix Resolution of BitmapMask gets somehow corrupted on game resize #6769 (thanks @pavels)Texture.getFrameBounds
method will now include the BASE texture in its calculations. This prevents it from returning a size of Infinity. This fixes an issue where a Tileset with margin/spacing loaded viaload.spritesheet
instead ofload.image
would have its margin and spacing ignored. Fix Tilemap support for spacing and/or margin broken since 3.80 #6823 (thanks @damian-pastorini)Input Bug Fixes
pointer.leftButtonReleased
will now returntrue
when multiple mouse buttons are being pressed.pointer.rightButtonReleased
will now returntrue
when multiple mouse buttons are being pressed.pointer.middleButtonReleased
will now returntrue
when multiple mouse buttons are being pressed.pointer.backButtonReleased
will now returntrue
when multiple mouse buttons are being pressed.pointer.forwardButtonReleased
will now returntrue
when multiple mouse buttons are being pressed. Fix pointer.leftButtonReleased() while holding RMB on DRAG_END reports false (wrong), instead of true (correct) value #6027 (thanks @michalfialadev)Examples, Documentation, Beta Testing and TypeScript
Thanks to the following for helping with the Phaser Examples, Beta Testing, Docs, and TypeScript definitions, either by reporting errors, fixing them, or helping author the docs:
@lgtome
@samme
@AlbertMontagutCasero
@rexrainbow
Deprecation Warning for the next release
The next release of Phaser will make the following API-breaking changes:
Phaser.Struct.Map
and replacing it with a regular JSMap
instance. This means methods likecontains
andsetAll
will be gone.Phaser.Struct.Set
and replacing it with a regular JSSet
instance. This means methods likeiterateLocal
will be gone.Create.GenerateTexture
, all of the Create Palettes and thecreate
folder will be removed.phaser-ie9.js
entry-point will be removed along with all associated polyfills.This discussion was created from the release Phaser v3.85.0 Beta 2.
Beta Was this translation helpful? Give feedback.
All reactions