@vpmedia/phaser 1.0.35 → 1.0.36

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
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",
@@ -59,32 +59,6 @@ export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin
59
59
  return data;
60
60
  }
61
61
 
62
- /**
63
- *
64
- * @param {object} game TBD
65
- * @param {object} json TBD
66
- * @returns {object} TBD
67
- */
68
- export function JSONData(game, json) {
69
- // Malformed?
70
- if (!json.frames) {
71
- return null;
72
- }
73
- // Let's create some frames then
74
- const data = new FrameData();
75
- // By this stage frames is a fully parsed array
76
- const frames = json.frames;
77
- let newFrame;
78
- for (let i = 0; i < frames.length; i += 1) {
79
- newFrame = data.addFrame(new Frame(i, frames[i].frame.x, frames[i].frame.y, frames[i].frame.w, frames[i].frame.h, frames[i].filename));
80
- if (frames[i].trimmed) {
81
- newFrame.setTrim(frames[i].trimmed, frames[i].sourceSize.w, frames[i].sourceSize.h, frames[i].spriteSourceSize.x, frames[i].spriteSourceSize.y, frames[i].spriteSourceSize.w, frames[i].spriteSourceSize.h);
82
- }
83
- }
84
- return data;
85
-
86
- }
87
-
88
62
  /**
89
63
  *
90
64
  * @param {object} game TBD
@@ -8,7 +8,7 @@ import BaseTexture from '../display/webgl/base_texture';
8
8
  import Signal from './signal';
9
9
  import Frame from './frame';
10
10
  import FrameData from './frame_data';
11
- import { JSONData, JSONDataHash } from './animation_parser';
11
+ import { JSONDataHash } from './animation_parser';
12
12
  import { jsonBitmapFont, xmlBitmapFont } from './loader_parser';
13
13
 
14
14
  export const CANVAS = 1;
@@ -113,12 +113,7 @@ export default class {
113
113
  data,
114
114
  base: new BaseTexture(data),
115
115
  };
116
- if (Array.isArray(atlasData.frames)) {
117
- // Let's just work it out from the frames array
118
- obj.frameData = JSONData(this.game, atlasData, key);
119
- } else {
120
- obj.frameData = JSONDataHash(this.game, atlasData, key);
121
- }
116
+ obj.frameData = JSONDataHash(this.game, atlasData, key);
122
117
  this._cache.image[key] = obj;
123
118
  this._resolveURL(url, obj);
124
119
  }
@@ -96,5 +96,4 @@ export const ROPE = 20; // deprecated
96
96
  export const CREATURE = 27; // deprecated
97
97
  export const PENDING_ATLAS = -1;
98
98
  // sprite sheet atlas
99
- export const TEXTURE_ATLAS_JSON_ARRAY = 0;
100
99
  export const TEXTURE_ATLAS_JSON_HASH = 1;
@@ -6,7 +6,7 @@
6
6
  import Signal from './signal';
7
7
  import Rectangle from '../geom/rectangle';
8
8
  import { canPlayAudio } from './device_util';
9
- import { TEXTURE_ATLAS_JSON_ARRAY, TEXTURE_ATLAS_JSON_HASH } from './const';
9
+ import { TEXTURE_ATLAS_JSON_HASH } from './const';
10
10
 
11
11
  export const TILED_JSON = 6;
12
12
  export const TILEMAP_CSV = 7;
@@ -311,20 +311,7 @@ export default class {
311
311
  return this;
312
312
  }
313
313
 
314
- atlasJSONArray(key, textureURL, atlasURL, atlasData) {
315
- return this.atlas(key, textureURL, atlasURL, atlasData, TEXTURE_ATLAS_JSON_ARRAY);
316
- }
317
-
318
- atlasJSONHash(key, textureURL, atlasURL, atlasData) {
319
- return this.atlas(key, textureURL, atlasURL, atlasData, TEXTURE_ATLAS_JSON_HASH);
320
- }
321
-
322
- atlasXML() {
323
- // TODO
324
- console.warn('loader.atlasXML() is not implemented');
325
- }
326
-
327
- atlas(key, textureURL, atlasURL = null, atlasData = null, format = TEXTURE_ATLAS_JSON_ARRAY) {
314
+ atlas(key, textureURL, atlasURL = null, atlasData = null, format = TEXTURE_ATLAS_JSON_HASH) {
328
315
  if (textureURL === undefined || textureURL === null) {
329
316
  textureURL = key + '.png';
330
317
  }
@@ -335,9 +322,6 @@ export default class {
335
322
  if (atlasURL) {
336
323
  this.addToFileList('textureatlas', key, textureURL, { atlasURL, format });
337
324
  } else {
338
- if (format === TEXTURE_ATLAS_JSON_ARRAY && typeof atlasData === 'string') {
339
- atlasData = JSON.parse(atlasData);
340
- }
341
325
  this.addToFileList('textureatlas', key, textureURL, { atlasURL: null, atlasData, format });
342
326
  }
343
327
  return this;
@@ -555,7 +539,7 @@ export default class {
555
539
  this.bitmapFont(file.key, file.textureURL, file.atlasURL, file.atlasData, file.xSpacing, file.ySpacing);
556
540
  break;
557
541
  case "atlas":
558
- this.atlas(file.key, file.textureURL, file.atlasURL, file.atlasData, file.format === 'TEXTURE_ATLAS_JSON_HASH' ? TEXTURE_ATLAS_JSON_HASH : TEXTURE_ATLAS_JSON_ARRAY);
542
+ this.atlas(file.key, file.textureURL, file.atlasURL, file.atlasData, TEXTURE_ATLAS_JSON_HASH);
559
543
  break;
560
544
  case "shader":
561
545
  this.shader(file.key, file.url, file.overwrite);
@@ -762,7 +746,7 @@ export default class {
762
746
  } else {
763
747
  // Load the JSON or XML before carrying on with the next file
764
748
  loadNext = false;
765
- if (file.format === TEXTURE_ATLAS_JSON_ARRAY || file.format === TEXTURE_ATLAS_JSON_HASH) {
749
+ if (file.format === TEXTURE_ATLAS_JSON_HASH) {
766
750
  this.xhrLoad(file, this.transformUrl(file.atlasURL, file), 'text', this.jsonLoadComplete);
767
751
  } else {
768
752
  throw new Error('Invalid Texture Atlas format: ' + file.format);