Skip to content

Upgrade Guide

Olivier Biot edited this page Jul 8, 2024 · 353 revisions

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.

melonJS 2 (ES6) Version

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.

17.x.x to 18.0.0 (Stable)

  • chore : deprecated classes and methods from version 15 and lower have been removed (Texture, DraggableEntity, DroptargetEntity, getScreenCanvas, getScreenContext, GUI_Object, getWidth, getHeight)

16.x.x to 17.0.0 (Stable)

  • loader : the nocache, crossOrigin and withCredentials loader options, now have to be set using the setOptions() method, for example : me.loader.setOptions({ crossOrigin : "anonymous" });

15.x.x to 16.0.0 (Stable)

no breaking API changes

14.5.x to 15.0.0 (Stable)

  • UI: GUI_Object is now deprecated and replaced by two new classes, UISpriteElement and UITextButton
  • Text : drawStroke() is now deprecated in favour of the lineWidth property, which when set to a value greater than 0 will automatically stroke the text

13.0.x to 14.0.0 (Stable)

no breaking API changes

12.0.x to 13.0.x (Stable)

  • device: as part of device refactoring to a proper ES6 syntax, the previous device.isFullScreen property has been changed into a device.isFullScreen() function
  • device: deprecated function device.turnOnPointerLock and device.turnOffPointerLock since version 10.3 have been removed; please use input.requestPointerLock() or input.exitPointerLock()
  • Physic: when applying a force, melonJS will now automatically reset the remaining force to 0 at the end of the update loop.

11.0.x to 12.0.x (Stable)

  • Core: utils.string helper trim functions have been removed in favour to their native es10 equivalent (String.trimLeft and String.trimRight)

10.12.x to 11.0.x (Stable)

  • Renderable: the Light2d constructor now takes an additional parameter (x, y, radiusX, [radiusY], [color], [intensity]) allowing to create elliptical shaped lights

10.5.x to 10.12.x (Stable)

no breaking API changes

10.4.x to 10.5.x (Stable)

  • Renderable: DraggableEntity and DroptargetEntity have been renamed to Draggable and DropTarget

10.3.x to 10.4.x (Stable)

  • Renderer: the video.renderer.Texture class is now directly available as TextureAtlas

10.0.x to 10.3.x (Stable)

  • Input: device.turnOnPointerLock() and device.turnOffPointerLock() have been replaced respectively by input.requestPointerLock() and input.exitPointerLock(), and updated to the latest 2.0 specs

9.1.x to 10.0.x (Stable)

  • Core : me.timer.lastUpdate has been moved to me.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() and me.event.unsubscribe() being replaced respectively by me.event.emit(), me.event.on() (or me.event.once()) and me.event.off().