@vpmedia/phaser 1.1.3 → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  @vpmedia/phaser
2
2
  ===============
3
3
 
4
- [![npm version](https://badge.fury.io/js/@vpmedia%2Fphaser.svg?v=1.1.3)](https://badge.fury.io/js/@vpmedia%2Fphaser)
4
+ [![npm version](https://badge.fury.io/js/@vpmedia%2Fphaser.svg?v=1.1.5)](https://badge.fury.io/js/@vpmedia%2Fphaser)
5
5
  [![Node.js CI](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml/badge.svg)](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml)
6
6
 
7
7
  @vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -31,9 +31,6 @@ export default class {
31
31
  this.m4a = false;
32
32
  this.webm = false;
33
33
  this.dolby = false;
34
- this.iPhone = false;
35
- this.iPad = false;
36
- this.pixelRatio = 1;
37
34
  this.fullscreen = false;
38
35
  this.requestFullscreen = '';
39
36
  this.cancelFullscreen = '';
@@ -191,16 +191,6 @@ export function checkAudio(device) {
191
191
  }
192
192
  }
193
193
 
194
- /**
195
- *
196
- * @param {object} device TBD
197
- */
198
- export function checkDevice(device) {
199
- device.pixelRatio = window.devicePixelRatio || 1;
200
- device.iPhone = navigator.userAgent.toLowerCase().indexOf('iphone') !== -1;
201
- device.iPad = navigator.userAgent.toLowerCase().indexOf('ipad') !== -1;
202
- }
203
-
204
194
  /**
205
195
  *
206
196
  * @param {object} device TBD
@@ -209,7 +199,6 @@ export function initialize(device) {
209
199
  checkOS(device);
210
200
  checkBrowser(device);
211
201
  checkAudio(device);
212
- checkDevice(device);
213
202
  checkFullScreenSupport(device);
214
203
  checkInput(device);
215
204
  }
@@ -170,36 +170,20 @@ export default class {
170
170
  }
171
171
 
172
172
  parseConfig(config) {
173
- /* game */
174
173
  this.parseConfigElement(config, 'width', 800);
175
174
  this.parseConfigElement(config, 'height', 600);
176
175
  this.parseConfigElement(config, 'backgroundColor', 0x000000);
177
- // Should the game loop force a logic update, regardless of the delta timer? Set to true if you know you need this. You can toggle it on the fly.
178
- this.parseConfigElement(config, 'forceSingleUpdate', true);
179
- /* canvas */
180
176
  this.parseConfigElement(config, 'canvasID', '');
181
177
  this.parseConfigElement(config, 'canvasStyle', undefined);
182
- /* renderer */
183
- // The resolution of your game.
184
178
  this.parseConfigElement(config, 'resolution', 1);
185
- // Use a transparent canvas background or not.
186
- this.parseConfigElement(config, 'transparent', false);
187
- // Anti-alias graphics. By default scaled images are smoothed in Canvas and WebGL, set anti-alias to false to disable this globally.
179
+ this.parseConfigElement(config, 'transparent', true);
188
180
  this.parseConfigElement(config, 'antialias', false);
189
- // The value of the preserveDrawingBuffer flag affects whether or not the contents of the stencil buffer is retained after rendering.
190
181
  this.parseConfigElement(config, 'preserveDrawingBuffer', false);
191
- // Clear the Canvas each frame before rendering the display list.
192
- // You can set this to `false` to gain some performance if your game always contains a background that completely fills the display.
193
182
  this.parseConfigElement(config, 'clearBeforeRender', false);
194
- // The Renderer this game will use. Either Const.RENDER_AUTO, Const.RENDER_CANVAS, Const.RENDER_WEBGL
183
+ this.parseConfigElement(config, 'roundPixels', true);
195
184
  this.parseConfigElement(config, 'renderType', RENDER_AUTO);
196
- // Force audio disabled
197
185
  this.parseConfigElement(config, 'isForceDisabledAudio', false);
198
- // Sets the number of maximum parallel requests for the loaded (in case of HTTP/2 you can raise this)
199
186
  this.parseConfigElement(config, 'maxParallelDownloads', 16);
200
- if (config.renderer) {
201
- this.config.renderType = config.renderer;
202
- }
203
187
  if (config.exceptionHandler) {
204
188
  this.exceptionHandler = config.exceptionHandler;
205
189
  } else {
@@ -6,7 +6,7 @@
6
6
  import DisplayObject from './display_object';
7
7
  import Image from './image';
8
8
  import Point from '../geom/point';
9
- import { BITMAP_TEXT } from '../core/const';
9
+ import { BITMAP_TEXT, SCALE_LINEAR, SCALE_NEAREST } from '../core/const';
10
10
 
11
11
  export default class extends DisplayObject {
12
12
 
@@ -313,9 +313,9 @@ export default class extends DisplayObject {
313
313
 
314
314
  set smoothed(value) {
315
315
  if (value) {
316
- this._data.base.scaleMode = 0;
316
+ this._data.base.scaleMode = SCALE_LINEAR;
317
317
  } else {
318
- this._data.base.scaleMode = 1;
318
+ this._data.base.scaleMode = SCALE_NEAREST;
319
319
  }
320
320
  }
321
321
 
@@ -4,7 +4,7 @@
4
4
  * @author Mat Groves http://matgroves.com/ @Doormat23
5
5
  * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
6
6
  */
7
- import { RENDER_CANVAS, SCALE_LINEAR, BLEND_NORMAL, BLEND_ADD, BLEND_MULTIPLY, BLEND_SCREEN, BLEND_OVERLAY, BLEND_DARKEN, BLEND_LIGHTEN, BLEND_COLOR_DODGE, BLEND_COLOR_BURN, BLEND_HARD_LIGHT, BLEND_SOFT_LIGHT, BLEND_DIFFERENCE, BLEND_EXCLUSION, BLEND_HUE, BLEND_SATURATION, BLEND_COLOR, BLEND_LUMINOSITY } from '../../core/const';
7
+ import { RENDER_CANVAS, SCALE_LINEAR, BLEND_NORMAL, BLEND_ADD, BLEND_MULTIPLY, BLEND_SCREEN, BLEND_OVERLAY, BLEND_DARKEN, BLEND_LIGHTEN, BLEND_COLOR_DODGE, BLEND_COLOR_BURN, BLEND_HARD_LIGHT, BLEND_SOFT_LIGHT, BLEND_DIFFERENCE, BLEND_EXCLUSION, BLEND_HUE, BLEND_SATURATION, BLEND_COLOR, BLEND_LUMINOSITY, SCALE_NEAREST } from '../../core/const';
8
8
  import { getSmoothingPrefix } from './util';
9
9
  import { detectCapabilities } from './tinter';
10
10
  import * as CanvasMaskManager from './masker';
@@ -30,9 +30,9 @@ export default class {
30
30
  this.renderSession = {
31
31
  context: this.context,
32
32
  maskManager: CanvasMaskManager,
33
- scaleMode: null,
33
+ scaleMode: game.config.antialias ? SCALE_LINEAR : SCALE_NEAREST,
34
34
  smoothProperty: getSmoothingPrefix(this.context),
35
- roundPixels: false,
35
+ roundPixels: game.config.roundPixels,
36
36
  };
37
37
  this.mapBlendModes();
38
38
  this.resize(this.width, this.height);
@@ -9,7 +9,7 @@ import EventManager from '../core/event_manager';
9
9
  import Rectangle from '../geom/rectangle';
10
10
  import DisplayObject from './display_object';
11
11
  import { clone } from '../geom/util/rectangle';
12
- import { IMAGE, PENDING_ATLAS, BLEND_NORMAL } from '../core/const';
12
+ import { IMAGE, PENDING_ATLAS, BLEND_NORMAL, SCALE_NEAREST } from '../core/const';
13
13
  import { setTexture, getBounds, getLocalBounds, renderCanvas, renderWebGL } from './sprite_util';
14
14
 
15
15
  export default class extends DisplayObject {
@@ -117,7 +117,7 @@ export default class extends DisplayObject {
117
117
  this._frame = clone(this.texture.frame);
118
118
  }
119
119
  if (!smoothed) {
120
- this.texture.baseTexture.scaleMode = 1;
120
+ this.texture.baseTexture.scaleMode = SCALE_NEAREST;
121
121
  }
122
122
  }
123
123