Skip to content

Commit 8b99c64

Browse files
committed
Merge branch 'master' of https://github.com/photonstorm/phaser into jsdoc
2 parents 23ad6e4 + 2a7cfb6 commit 8b99c64

12 files changed

Lines changed: 620 additions & 95 deletions

File tree

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/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;

0 commit comments

Comments
 (0)