Skip to content

Commit c4739dc

Browse files
committed
Merge branch 'master' of https://github.com/svipal/phaser
2 parents 95df0be + cf34877 commit c4739dc

57 files changed

Lines changed: 491 additions & 308 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
* `Line.GetEasedPoints` is a new function that will take a Line, a quantity, and an ease function, and returns an array of points where each point has been spaced out across the length of the Line based on the ease function given.
88
* `XHRSettings.withCredentials` is a new boolean property that controls the `withCredentials` setting of the XHR Request made by the Loader. It indicates whether or not cross-site Access-Control requests should be made using credentials such as cookies, authorization headers or TLS client certificates. You can set this on a per-file basis, or global in the Game Config.
99
* `Config.loaderWithCredentials` is the new global setting for `XHRSettings.withCredentials`.
10+
* `Camera.renderToGame` is a new property used in conjunction with `renderToTexture`. It controls if the Camera should still render to the Game canvas after rendering to its own texture or not. By default, it will render to both, but you can now toggle this at run-time.
11+
* `Camera.setRenderToTexture` has a new optional parameter `renderToGame` which sets the `Camera.renderToGame` property, controlling if the Camera should render to both its texture and the Game canvas, or just its texture.
1012

1113
### Updates
1214

1315
* `XHRLoader` will now use the `XHRSettings.withCredentials` as set in the file or global loader config.
16+
* `Animation.setCurrentFrame` will no longer try to call `setOrigin` or `updateDisplayOrigin` if the Game Object doesn't have the Origin component, preventing unknown function errors.
17+
* `MatterTileBody` now extends `EventEmitter`, meaning you can listen to collision events from Tiles directly and it will no longer throw errors about `gameObject.emit` not working. Fix #4967 (thanks @reinildo)
1418

1519
### Bug Fixes
1620

@@ -20,7 +24,7 @@
2024

2125
My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs:
2226

23-
27+
@JasonHK
2428

2529
## Version 3.22 - Kohaku - January 15th 2020
2630

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
![Phaser Header](https://phaser.io/images/github/300/phaser-header.png "Phaser 3 Header Banner")
44

5+
[![Discord chat](https://img.shields.io/discord/244245946873937922?style=for-the-badge)](https://discord.gg/phaser)
6+
[![Twitter Follow](https://img.shields.io/twitter/follow/phaser_?style=for-the-badge)](https://twitter.com/phaser_)
7+
![GitHub All Releases](https://img.shields.io/github/downloads/photonstorm/phaser/total?style=for-the-badge)
8+
![npm](https://img.shields.io/npm/dy/phaser?label=npm&style=for-the-badge)
9+
510
Phaser is a fast, free, and fun open source HTML5 game framework that offers WebGL and Canvas rendering across desktop and mobile web browsers. Games can be compiled to iOS, Android and native apps by using 3rd party tools. You can use JavaScript or TypeScript for development.
611

712
Along with the fantastic open source community, Phaser is actively developed and maintained by [Photon Storm](http://www.photonstorm.com). As a result of rapid support, and a developer friendly API, Phaser is currently one of the [most starred](https://github.com/collections/javascript-game-engines) game frameworks on GitHub.

src/cameras/2d/Camera.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,24 @@ var Camera = new Class({
208208
*/
209209
this.renderToTexture = false;
210210

211+
/**
212+
* If this Camera is rendering to a texture (via `setRenderToTexture`) then you
213+
* have the option to control if it should also render to the Game canvas as well.
214+
*
215+
* By default, a Camera will render both to its texture and to the Game canvas.
216+
*
217+
* However, if you set ths property to `false` it will only render to the texture
218+
* and skip rendering to the Game canvas.
219+
*
220+
* Setting this property if the Camera isn't rendering to a texture has no effect.
221+
*
222+
* @name Phaser.Cameras.Scene2D.Camera#renderToGame
223+
* @type {boolean}
224+
* @default true
225+
* @since 3.23.0
226+
*/
227+
this.renderToGame = true;
228+
211229
/**
212230
* If this Camera has been set to render to a texture then this holds a reference
213231
* to the HTML Canvas Element that the Camera is drawing to.
@@ -304,6 +322,9 @@ var Camera = new Class({
304322
*
305323
* You should not enable this unless you plan on actually using the texture it creates
306324
* somehow, otherwise you're just doubling the work required to render your game.
325+
*
326+
* If you only require the Camera to render to a texture, and not also to the Game,
327+
* them set the `renderToGame` parameter to `false`.
307328
*
308329
* To temporarily disable rendering to a texture, toggle the `renderToTexture` boolean.
309330
*
@@ -314,11 +335,14 @@ var Camera = new Class({
314335
* @since 3.13.0
315336
*
316337
* @param {(string|Phaser.Renderer.WebGL.WebGLPipeline)} [pipeline] - An optional WebGL Pipeline to render with, can be either a string which is the name of the pipeline, or a pipeline reference.
338+
* @param {boolean} [renderToGame=true] - If you do not need the Camera to still render to the Game, set this parameter to `false`.
317339
*
318340
* @return {Phaser.Cameras.Scene2D.Camera} This Camera instance.
319341
*/
320-
setRenderToTexture: function (pipeline)
342+
setRenderToTexture: function (pipeline, renderToGame)
321343
{
344+
if (renderToGame === undefined) { renderToGame = true; }
345+
322346
var renderer = this.scene.sys.game.renderer;
323347

324348
if (renderer.gl)
@@ -333,6 +357,7 @@ var Camera = new Class({
333357
}
334358

335359
this.renderToTexture = true;
360+
this.renderToGame = renderToGame;
336361

337362
if (pipeline)
338363
{

src/gameobjects/bitmaptext/dynamic/DynamicBitmapText.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ var DynamicBitmapText = new Class({
155155
* @param {number} width - The width of the crop.
156156
* @param {number} height - The height of the crop.
157157
*
158-
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
158+
* @return {this} This Game Object.
159159
*/
160160
setSize: function (width, height)
161161
{
@@ -179,7 +179,7 @@ var DynamicBitmapText = new Class({
179179
*
180180
* @param {Phaser.Types.GameObjects.BitmapText.DisplayCallback} callback - The display callback to set.
181181
*
182-
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
182+
* @return {this} This Game Object.
183183
*/
184184
setDisplayCallback: function (callback)
185185
{
@@ -196,7 +196,7 @@ var DynamicBitmapText = new Class({
196196
*
197197
* @param {number} value - The horizontal scroll position to set.
198198
*
199-
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
199+
* @return {this} This Game Object.
200200
*/
201201
setScrollX: function (value)
202202
{
@@ -213,7 +213,7 @@ var DynamicBitmapText = new Class({
213213
*
214214
* @param {number} value - The vertical scroll position to set.
215215
*
216-
* @return {Phaser.GameObjects.DynamicBitmapText} This Game Object.
216+
* @return {this} This Game Object.
217217
*/
218218
setScrollY: function (value)
219219
{

src/gameobjects/blitter/Bob.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ var Bob = new Class({
152152
*
153153
* @param {(string|integer|Phaser.Textures.Frame)} [frame] - The frame to be used during rendering.
154154
*
155-
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
155+
* @return {this} This Bob Game Object.
156156
*/
157157
setFrame: function (frame)
158158
{
@@ -178,7 +178,7 @@ var Bob = new Class({
178178
* @method Phaser.GameObjects.Bob#resetFlip
179179
* @since 3.0.0
180180
*
181-
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
181+
* @return {this} This Bob Game Object.
182182
*/
183183
resetFlip: function ()
184184
{
@@ -202,7 +202,7 @@ var Bob = new Class({
202202
* @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object.
203203
* @param {(string|integer|Phaser.Textures.Frame)} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using.
204204
*
205-
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
205+
* @return {this} This Bob Game Object.
206206
*/
207207
reset: function (x, y, frame)
208208
{
@@ -234,7 +234,7 @@ var Bob = new Class({
234234
* @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object.
235235
* @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object.
236236
*
237-
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
237+
* @return {this} This Bob Game Object.
238238
*/
239239
setPosition: function (x, y)
240240
{
@@ -252,7 +252,7 @@ var Bob = new Class({
252252
*
253253
* @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped.
254254
*
255-
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
255+
* @return {this} This Bob Game Object.
256256
*/
257257
setFlipX: function (value)
258258
{
@@ -269,7 +269,7 @@ var Bob = new Class({
269269
*
270270
* @param {boolean} value - The flipped state. `false` for no flip, or `true` to be flipped.
271271
*
272-
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
272+
* @return {this} This Bob Game Object.
273273
*/
274274
setFlipY: function (value)
275275
{
@@ -287,7 +287,7 @@ var Bob = new Class({
287287
* @param {boolean} x - The horizontal flipped state. `false` for no flip, or `true` to be flipped.
288288
* @param {boolean} y - The horizontal flipped state. `false` for no flip, or `true` to be flipped.
289289
*
290-
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
290+
* @return {this} This Bob Game Object.
291291
*/
292292
setFlip: function (x, y)
293293
{
@@ -307,7 +307,7 @@ var Bob = new Class({
307307
*
308308
* @param {boolean} value - The visible state of the Game Object.
309309
*
310-
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
310+
* @return {this} This Bob Game Object.
311311
*/
312312
setVisible: function (value)
313313
{
@@ -327,7 +327,7 @@ var Bob = new Class({
327327
*
328328
* @param {number} value - The alpha value used for this Bob. Between 0 and 1.
329329
*
330-
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
330+
* @return {this} This Bob Game Object.
331331
*/
332332
setAlpha: function (value)
333333
{
@@ -344,7 +344,7 @@ var Bob = new Class({
344344
*
345345
* @param {number} value - The tint value used for this Bob. Between 0 and 0xffffff.
346346
*
347-
* @return {Phaser.GameObjects.Bob} This Bob Game Object.
347+
* @return {this} This Bob Game Object.
348348
*/
349349
setTint: function (value)
350350
{

src/gameobjects/components/Animation.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,13 +1020,16 @@ var Animation = new Class({
10201020

10211021
gameObject.setSizeToFrame();
10221022

1023-
if (animationFrame.frame.customPivot)
1023+
if (gameObject._originComponent)
10241024
{
1025-
gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY);
1026-
}
1027-
else
1028-
{
1029-
gameObject.updateDisplayOrigin();
1025+
if (animationFrame.frame.customPivot)
1026+
{
1027+
gameObject.setOrigin(animationFrame.frame.pivotX, animationFrame.frame.pivotY);
1028+
}
1029+
else
1030+
{
1031+
gameObject.updateDisplayOrigin();
1032+
}
10301033
}
10311034

10321035
return gameObject;

src/gameobjects/components/PathFollower.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ var PathFollower = {
110110
* @param {Phaser.Curves.Path} path - The Path this PathFollower is following. It can only follow one Path at a time.
111111
* @param {(number|Phaser.Types.GameObjects.PathFollower.PathConfig|Phaser.Types.Tweens.NumberTweenBuilderConfig)} [config] - Settings for the PathFollower.
112112
*
113-
* @return {Phaser.GameObjects.PathFollower} This Game Object.
113+
* @return {this} This Game Object.
114114
*/
115115
setPath: function (path, config)
116116
{
@@ -142,7 +142,7 @@ var PathFollower = {
142142
* @param {boolean} value - Whether the PathFollower should automatically rotate to point in the direction of the Path.
143143
* @param {number} [offset=0] - Rotation offset in degrees.
144144
*
145-
* @return {Phaser.GameObjects.PathFollower} This Game Object.
145+
* @return {this} This Game Object.
146146
*/
147147
setRotateToPath: function (value, offset)
148148
{
@@ -181,7 +181,7 @@ var PathFollower = {
181181
* @param {(number|Phaser.Types.GameObjects.PathFollower.PathConfig|Phaser.Types.Tweens.NumberTweenBuilderConfig)} [config={}] - The duration of the follow, or a PathFollower config object.
182182
* @param {number} [startAt=0] - Optional start position of the follow, between 0 and 1.
183183
*
184-
* @return {Phaser.GameObjects.PathFollower} This Game Object.
184+
* @return {this} This Game Object.
185185
*/
186186
startFollow: function (config, startAt)
187187
{
@@ -271,7 +271,7 @@ var PathFollower = {
271271
* @method Phaser.GameObjects.Components.PathFollower#pauseFollow
272272
* @since 3.3.0
273273
*
274-
* @return {Phaser.GameObjects.PathFollower} This Game Object.
274+
* @return {this} This Game Object.
275275
*/
276276
pauseFollow: function ()
277277
{
@@ -293,7 +293,7 @@ var PathFollower = {
293293
* @method Phaser.GameObjects.Components.PathFollower#resumeFollow
294294
* @since 3.3.0
295295
*
296-
* @return {Phaser.GameObjects.PathFollower} This Game Object.
296+
* @return {this} This Game Object.
297297
*/
298298
resumeFollow: function ()
299299
{
@@ -315,7 +315,7 @@ var PathFollower = {
315315
* @method Phaser.GameObjects.Components.PathFollower#stopFollow
316316
* @since 3.3.0
317317
*
318-
* @return {Phaser.GameObjects.PathFollower} This Game Object.
318+
* @return {this} This Game Object.
319319
*/
320320
stopFollow: function ()
321321
{

src/gameobjects/components/TransformMatrix.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ var TransformMatrix = new Class({
438438
* @param {Phaser.GameObjects.Components.TransformMatrix} rhs - The Matrix to multiply by.
439439
* @param {Phaser.GameObjects.Components.TransformMatrix} [out] - An optional Matrix to store the results in.
440440
*
441-
* @return {Phaser.GameObjects.Components.TransformMatrix} Either this TransformMatrix, or the `out` Matrix, if given in the arguments.
441+
* @return {(this|Phaser.GameObjects.Components.TransformMatrix)} Either this TransformMatrix, or the `out` Matrix, if given in the arguments.
442442
*/
443443
multiply: function (rhs, out)
444444
{

0 commit comments

Comments
 (0)