Skip to content

Commit 9500a6e

Browse files
committed
When calling generateFrameNames to define an animation from a texture atlas you can now leave out all of the config properties and it will create an animation using every frame found in the atlas. Please understand you've no control over the sequence of these frames if you do this and it's entirely dictated by the json data
1 parent 6d1166a commit 9500a6e

2 files changed

Lines changed: 29 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,32 @@
11
# Change Log
22

3-
## Version 3.next - in development
3+
## Version 3.8.0 - in development
44

55
### New Plugin Manager
66

7-
TODO
7+
New in this release is a revamped Plugin Manager. Phaser has always used plugins extensively internally but this release opens them up and builds in a lot of new features making them easy for you to both create and digest.
8+
9+
There is a new `Phaser.Plugins` namespace in which the classes live. The functions of the old PluginManager have moved to the new PluginCache and the PluginManager, which is available under `this.plugins` from all Scenes by default, now allows you to install and access any plugin.
10+
11+
Plugins are split into two different types: A Global Plugin and a Scene Plugin.
12+
13+
A Global Plugin is a plugin that lives within the Plugin Manager rather than a Scene. You can get access to it by calling `PluginManager.get` and providing a key. Any Scene that requests a plugin in this way will all get access to the same plugin instance, allowing you to use a single plugin across multiple Scenes.
14+
15+
A Scene Plugin is a plugin dedicated to running within a Scene. These are different to Global Plugins in that their instances do not live within the Plugin Manager, but within the Scene Systems class instead. And that every Scene created is given its own unique instance of a Scene Plugin. Examples of core Scene Plugins include the Input Plugin, the Tween Plugin and the physics Plugins.
16+
17+
Plugins can now be installed in 3 different ways: 1) You can preload them, using the `load.plugin` and the new `load.scenePlugin` methods. This will allow you to load externally hosted plugins into your game, or pull down a plugin dynamically at run-time. 2) You can install global and scene plugins in your Game Configuration. The plugin code can be bundled with your game code into a single bundle. By specifying plugins in the game config they're instantly available as soon as your game boots. Finally, you can install plugins at run-time directly from within a Scene.
18+
19+
Plugins can also create brand new Game Objects and File Types, which install themselves into the respective factories. This means you can now write a plugin that adds a new file type and Game Object in a single package.
20+
21+
The new Plugin Manager and associated classes are 100% covered by JSDocs and there are stacks of new examples in the `plugins` folder in the Phaser 3 Labs too, so please dig in and have a play with these powerful new things!
822

923
### New Features
1024

1125
* You can pass in your own `canvas` and `context` elements in your Game Config and Phaser will use those to render with instead of creating its own. This also allows you to pass in a WebGL 2 context. Fix #3653 (thanks @tgrajewski)
1226
* WebGLRenderer.config has a new property `maxTextures` which is derived from `gl.MAX_TEXTURE_IMAGE_UNITS`, you can get it via the new method `getMaxTextures()`.
1327
* WebGLRenderer.config has a new property `maxTextureSize` which is derived from `gl.MAX_TEXTURE_SIZE`, you can get it via the new method `getMaxTextureSize()`
1428
* WebGLRenderer has a new property `compression` which holds the browser / devices compressed texture support gl extensions, which is populated during `init`.
29+
* When calling `generateFrameNames` to define an animation from a texture atlas you can now leave out all of the config properties and it will create an animation using every frame found in the atlas. Please understand you've no control over the sequence of these frames if you do this and it's entirely dictated by the json data (thanks @Aram19)
1530

1631
### Updates
1732

src/animations/AnimationManager.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,19 @@ var AnimationManager = new Class({
277277
var i;
278278
var frame;
279279

280-
// Have they provided their own custom frame sequence array?
281-
if (Array.isArray(frames))
280+
if (frames === false)
282281
{
282+
// Use every frame in the atlas?
283+
frames = texture.getFrameNames();
284+
285+
for (i = 0; i < frames.length; i++)
286+
{
287+
out.push({ key: key, frame: frames[i] });
288+
}
289+
}
290+
else if (Array.isArray(frames))
291+
{
292+
// Have they provided their own custom frame sequence array?
283293
for (i = 0; i < frames.length; i++)
284294
{
285295
frame = prefix + Pad(frames[i], zeroPad, '0', 1) + suffix;
@@ -363,7 +373,6 @@ var AnimationManager = new Class({
363373
else
364374
{
365375
// No endFrame then see if we can get it
366-
367376
if (endFrame === -1)
368377
{
369378
endFrame = texture.frameTotal;

0 commit comments

Comments
 (0)