You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiple Batched Texture support is now available. This is a WebGL feature that can seriously decrease the volume of draw calls made in complex, or asset heavy, games. To enable it you can either use the new renderer type Phaser.WEBGL_MULTI, or you can pass the property multiTexture: true in a Phaser.Game configuration object. Once enabled, it cannot be disabled.
`game.renderer.setTexturePriority` is the method that goes with the Multiple Texture support. It takes an array as its single argument. The array consists of Phaser.Cache image key strings. Phaser will then try to batch as many of the textures as it can, depending on the hardware limits. If for example the GPU can only batch 8 textures, and you provide an array of 16, then only the first 8 in the array will be batched.
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -309,6 +309,8 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
309
309
310
310
### New Features
311
311
312
+
* Multiple Batched Texture support is now available. This is a WebGL feature that can seriously decrease the volume of draw calls made in complex, or asset heavy, games. To enable it you can either use the new renderer type `Phaser.WEBGL_MULTI`, or you can pass the property `multiTexture: true` in a Phaser.Game configuration object. Once enabled, it cannot be disabled.
313
+
*`game.renderer.setTexturePriority` is the method that goes with the Multiple Texture support. It takes an array as its single argument. The array consists of Phaser.Cache image key strings. Phaser will then try to batch as many of the textures as it can, depending on the hardware limits. If for example the GPU can only batch 8 textures, and you provide an array of 16, then only the first 8 in the array will be batched.
312
314
* Weapon.multiFire is a new property that allows you to set a Weapon as being allowed to call `fire` as many times as you like, per game loop. This allows a single Weapon instance to fire multiple bullets.
313
315
* Weapon.fire has two new arguments: `offsetX` and `offsetY`. If the bullet is fired from a tracked Sprite or Pointer, or the `from` argument is set, this applies a horizontal and vertical offset from the launch position.
314
316
* Weapon.fireOffset attempts to fire a single Bullet from a tracked Sprite or Pointer, but applies an offset to the position first. This is a shorter form of calling `Weapon.fire` and passing in the offset arguments.
@@ -320,7 +322,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
320
322
* TypeScript definitions fixes and updates (thanks @chriteixeira@StealthC@Lopdo)
321
323
* Docs typo fixes (thanks @JTronLabs@samme)
322
324
*`Phaser.Line.fromSprite` now uses the Sprite.centerX and centerY properties if the `useCenter` argument is true. Before it required you to have overridden the Sprite and added the property yourself (thanks @samme#2729)
323
-
*
325
+
* Updated the pointer check code in the Device class, to get rid of the message `Navigator.pointerEnabled is a non-standard API added for experiments only. It will be removed in near future.` in Chrome.
* "Hell, there are no rules here - we're trying to accomplish something."
12
-
* Thomas A. Edison
38
+
* ```
39
+
* In the example above, 4 States are added to the State Manager, and Phaser is told to
40
+
* start running the `Boot` state when it has finished initializing. There are example
41
+
* project templates you can use in the Phaser GitHub repo, inside the `resources` folder.
42
+
*
43
+
* Instead of specifying arguments you can also pass a single object instead:
44
+
*
45
+
* ```
46
+
* var config = {
47
+
* width: 800,
48
+
* height: 600,
49
+
* renderer: Phaser.AUTO,
50
+
* antialias: true,
51
+
* multiTexture: true,
52
+
* state: {
53
+
* preload: preload,
54
+
* create: create,
55
+
* update: update
56
+
* }
57
+
* }
58
+
*
59
+
* var game = new Phaser.Game(config);
60
+
* ```
13
61
*
14
62
* @class Phaser.Game
15
63
* @constructor
16
64
* @param {number|string} [width=800] - The width of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage width of the parent container, or the browser window if no parent is given.
17
65
* @param {number|string} [height=600] - The height of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage height of the parent container, or the browser window if no parent is given.
18
-
* @param {number} [renderer=Phaser.AUTO] - Which renderer to use: Phaser.AUTO will auto-detect, Phaser.WEBGL, Phaser.CANVAS or Phaser.HEADLESS (no rendering at all).
66
+
* @param {number} [renderer=Phaser.AUTO] - Which renderer to use: Phaser.AUTO will auto-detect, Phaser.WEBGL, Phaser.WEBGL_MULTI, Phaser.CANVAS or Phaser.HEADLESS (no rendering at all).
19
67
* @param {string|HTMLElement} [parent=''] - The DOM element into which this games canvas will be injected. Either a DOM ID (string) or the element itself.
20
68
* @param {object} [state=null] - The default state object. A object consisting of Phaser.State functions (preload, create, update, render) or null.
21
69
* @param {boolean} [transparent=false] - Use a transparent canvas background or not.
* @property {number} id - Phaser Game ID (for when Pixi supports multiple instances).
76
+
* @property {number} id - Phaser Game ID
29
77
* @readonly
30
78
*/
31
79
this.id=Phaser.GAMES.push(this)-1;
@@ -101,6 +149,19 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
101
149
*/
102
150
this.antialias=true;
103
151
152
+
/**
153
+
* Has support for Multiple bound Textures in WebGL been enabled? This is a read-only property.
154
+
* To set it you need to either specify `Phaser.WEBGL_MULTI` as the renderer type, or use the Game
155
+
* Configuration object with the property `multiTexture` set to true. It has to be enabled before
156
+
* Pixi boots, and cannot be changed after the game is running. Once enabled, take advantage of it
157
+
* via the `game.renderer.setTexturePriority` method.
158
+
*
159
+
* @property {boolean} multiTexture
160
+
* @default
161
+
* @readOnly
162
+
*/
163
+
this.multiTexture=false;
164
+
104
165
/**
105
166
* @property {boolean} preserveDrawingBuffer - The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering.
106
167
* @default
@@ -122,7 +183,7 @@ Phaser.Game = function (width, height, renderer, parent, state, transparent, ant
122
183
this.renderer=null;
123
184
124
185
/**
125
-
* @property {number} renderType - The Renderer this game will use. Either Phaser.AUTO, Phaser.CANVAS, Phaser.WEBGL, or Phaser.HEADLESS.
186
+
* @property {number} renderType - The Renderer this game will use. Either Phaser.AUTO, Phaser.CANVAS, Phaser.WEBGL, Phaser.WEBGL_MULTI or Phaser.HEADLESS.
126
187
* @readonly
127
188
*/
128
189
this.renderType=Phaser.AUTO;
@@ -482,6 +543,11 @@ Phaser.Game.prototype = {
482
543
this.antialias=config['antialias'];
483
544
}
484
545
546
+
if(config['multiTexture']!==undefined)
547
+
{
548
+
this.multiTexture=config['multiTexture'];
549
+
}
550
+
485
551
if(config['resolution'])
486
552
{
487
553
this.resolution=config['resolution'];
@@ -718,6 +784,12 @@ Phaser.Game.prototype = {
718
784
else
719
785
{
720
786
// They requested WebGL and their browser supports it
0 commit comments