-
-
Notifications
You must be signed in to change notification settings - Fork 644
Upgrade Guide
This page list the public APIs change between melonJS release. To be noted that we always provide backward compatibility as much as possible by providing method wrapping on public deprecated API(s).
Important: melonJS uses Semantic Versioning, which means that only MAJOR version (e.g. moving from 9.x.x to 10.x.x) will introduce breaking API changes. For any other MINOR or PATCH version, melonJS API provides seamless upgrade.
Note: As the initial 10.0 version marks the release of melonJS2, that is now fully ES6 compliant, all deprecated API and method from previous "legacy" versions (9.x and lower) have been removed. If you are looking for the changelog for the legacy version see here, see as well here for a dedicated upgrading guide from Legacy version of melonJS to melonJS 2
Note: To keep our code base as clean as possible, deprecated API are being kept until the next N+2 version, for example when publishing a new major 17.x version of melonJS, all deprecated API in version 14.x and before will be removed.
- chore : deprecated classes and methods from version 15 and lower have been removed (
Texture
,DraggableEntity
,DroptargetEntity
,getScreenCanvas
,getScreenContext
,GUI_Object
,getWidth
,getHeight
)
- loader : the
nocache
,crossOrigin
andwithCredentials
loader options, now have to be set using thesetOptions()
method, for example :me.loader.setOptions({ crossOrigin : "anonymous" });
no breaking API changes
- UI:
GUI_Object
is now deprecated and replaced by two new classes,UISpriteElement
andUITextButton
- Text :
drawStroke()
is now deprecated in favour of thelineWidth
property, which when set to a value greater than 0 will automatically stroke the text
no breaking API changes
- device: as part of
device
refactoring to a proper ES6 syntax, the previousdevice.isFullScreen
property has been changed into adevice.isFullScreen()
function - device: deprecated function
device.turnOnPointerLock
anddevice.turnOffPointerLock
since version 10.3 have been removed; please useinput.requestPointerLock()
orinput.exitPointerLock()
- Physic: when applying a force, melonJS will now automatically reset the remaining force to 0 at the end of the update loop.
- Core:
utils.string
helper trim functions have been removed in favour to their native es10 equivalent (String.trimLeft
andString.trimRight
)
- Renderable: the Light2d constructor now takes an additional parameter (
x, y, radiusX, [radiusY], [color], [intensity])
allowing to create elliptical shaped lights
no breaking API changes
- Renderable:
DraggableEntity
andDroptargetEntity
have been renamed toDraggable
andDropTarget
- Renderer: the
video.renderer.Texture
class is now directly available asTextureAtlas
- Input:
device.turnOnPointerLock()
anddevice.turnOffPointerLock()
have been replaced respectively byinput.requestPointerLock()
andinput.exitPointerLock()
, and updated to the latest 2.0 specs
- Core :
me.timer.lastUpdate
has been moved tome.game.lastUpdate
- Physic : physic body update and collision check is now automatically done through the world simulation update loop (see the specific wiki entry on upgrading to melonJS 2)
- Event : minPubSub event based implementation has been replaced by a nodeJS event emitter based implementation, with
me.event.publish()
,me.event.subscribe()
andme.event.unsubscribe()
being replaced respectively byme.event.emit()
,me.event.on()
(orme.event.once()
) andme.event.off()
.