@vpmedia/phaser 1.0.1 → 1.0.2

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.
Files changed (107) hide show
  1. package/dist/phaser.cjs.LICENSE.txt +1 -1
  2. package/dist/phaser.js.LICENSE.txt +1 -1
  3. package/package.json +2 -3
  4. package/src/index.js +99 -0
  5. package/src/phaser/core/animation.js +355 -0
  6. package/src/phaser/core/animation_manager.js +238 -0
  7. package/src/phaser/core/animation_parser.js +130 -0
  8. package/src/phaser/core/array_set.js +108 -0
  9. package/src/phaser/core/cache.js +558 -0
  10. package/src/phaser/core/const.js +106 -0
  11. package/src/phaser/core/device.js +67 -0
  12. package/src/phaser/core/device_util.js +386 -0
  13. package/src/phaser/core/dom.js +207 -0
  14. package/src/phaser/core/event_manager.js +243 -0
  15. package/src/phaser/core/factory.js +74 -0
  16. package/src/phaser/core/frame.js +75 -0
  17. package/src/phaser/core/frame_data.js +84 -0
  18. package/src/phaser/core/frame_util.js +31 -0
  19. package/src/phaser/core/game.js +412 -0
  20. package/src/phaser/core/input.js +401 -0
  21. package/src/phaser/core/input_button.js +102 -0
  22. package/src/phaser/core/input_handler.js +687 -0
  23. package/src/phaser/core/input_mouse.js +289 -0
  24. package/src/phaser/core/input_mspointer.js +197 -0
  25. package/src/phaser/core/input_pointer.js +427 -0
  26. package/src/phaser/core/input_touch.js +157 -0
  27. package/src/phaser/core/loader.js +946 -0
  28. package/src/phaser/core/loader_parser.js +105 -0
  29. package/src/phaser/core/raf.js +46 -0
  30. package/src/phaser/core/raf_fb.js +75 -0
  31. package/src/phaser/core/raf_to.js +34 -0
  32. package/src/phaser/core/scale_manager.js +806 -0
  33. package/src/phaser/core/scene.js +66 -0
  34. package/src/phaser/core/scene_manager.js +310 -0
  35. package/src/phaser/core/signal.js +175 -0
  36. package/src/phaser/core/signal_binding.js +69 -0
  37. package/src/phaser/core/sound.js +538 -0
  38. package/src/phaser/core/sound_manager.js +365 -0
  39. package/src/phaser/core/stage.js +108 -0
  40. package/src/phaser/core/time.js +203 -0
  41. package/src/phaser/core/timer.js +276 -0
  42. package/src/phaser/core/timer_event.js +21 -0
  43. package/src/phaser/core/tween.js +329 -0
  44. package/src/phaser/core/tween_data.js +258 -0
  45. package/src/phaser/core/tween_easing.js +316 -0
  46. package/src/phaser/core/tween_manager.js +185 -0
  47. package/src/phaser/core/world.js +18 -0
  48. package/src/phaser/display/bitmap_text.js +322 -0
  49. package/src/phaser/display/button.js +194 -0
  50. package/src/phaser/display/canvas/buffer.js +36 -0
  51. package/src/phaser/display/canvas/graphics.js +227 -0
  52. package/src/phaser/display/canvas/masker.js +39 -0
  53. package/src/phaser/display/canvas/pool.js +121 -0
  54. package/src/phaser/display/canvas/renderer.js +123 -0
  55. package/src/phaser/display/canvas/tinter.js +141 -0
  56. package/src/phaser/display/canvas/util.js +151 -0
  57. package/src/phaser/display/display_object.js +597 -0
  58. package/src/phaser/display/graphics.js +723 -0
  59. package/src/phaser/display/graphics_data.js +27 -0
  60. package/src/phaser/display/graphics_data_util.js +14 -0
  61. package/src/phaser/display/group.js +227 -0
  62. package/src/phaser/display/image.js +288 -0
  63. package/src/phaser/display/sprite_batch.js +15 -0
  64. package/src/phaser/display/sprite_util.js +248 -0
  65. package/src/phaser/display/text.js +1089 -0
  66. package/src/phaser/display/webgl/abstract_filter.js +25 -0
  67. package/src/phaser/display/webgl/base_texture.js +68 -0
  68. package/src/phaser/display/webgl/blend_manager.js +35 -0
  69. package/src/phaser/display/webgl/earcut.js +647 -0
  70. package/src/phaser/display/webgl/earcut_node.js +28 -0
  71. package/src/phaser/display/webgl/fast_sprite_batch.js +242 -0
  72. package/src/phaser/display/webgl/filter_manager.js +46 -0
  73. package/src/phaser/display/webgl/filter_texture.js +61 -0
  74. package/src/phaser/display/webgl/graphics.js +618 -0
  75. package/src/phaser/display/webgl/graphics_data.js +42 -0
  76. package/src/phaser/display/webgl/mask_manager.js +36 -0
  77. package/src/phaser/display/webgl/render_texture.js +81 -0
  78. package/src/phaser/display/webgl/renderer.js +234 -0
  79. package/src/phaser/display/webgl/shader/complex.js +74 -0
  80. package/src/phaser/display/webgl/shader/fast.js +97 -0
  81. package/src/phaser/display/webgl/shader/normal.js +225 -0
  82. package/src/phaser/display/webgl/shader/primitive.js +72 -0
  83. package/src/phaser/display/webgl/shader/strip.js +77 -0
  84. package/src/phaser/display/webgl/shader_manager.js +89 -0
  85. package/src/phaser/display/webgl/sprite_batch.js +320 -0
  86. package/src/phaser/display/webgl/stencil_manager.js +170 -0
  87. package/src/phaser/display/webgl/texture.js +117 -0
  88. package/src/phaser/display/webgl/texture_util.js +32 -0
  89. package/src/phaser/display/webgl/util.js +74 -0
  90. package/src/phaser/geom/circle.js +186 -0
  91. package/src/phaser/geom/ellipse.js +65 -0
  92. package/src/phaser/geom/line.js +190 -0
  93. package/src/phaser/geom/matrix.js +147 -0
  94. package/src/phaser/geom/point.js +164 -0
  95. package/src/phaser/geom/polygon.js +141 -0
  96. package/src/phaser/geom/rectangle.js +306 -0
  97. package/src/phaser/geom/rounded_rectangle.js +36 -0
  98. package/src/phaser/geom/util/circle.js +115 -0
  99. package/src/phaser/geom/util/ellipse.js +30 -0
  100. package/src/phaser/geom/util/line.js +130 -0
  101. package/src/phaser/geom/util/matrix.js +48 -0
  102. package/src/phaser/geom/util/point.js +276 -0
  103. package/src/phaser/geom/util/polygon.js +24 -0
  104. package/src/phaser/geom/util/rectangle.js +212 -0
  105. package/src/phaser/geom/util/rounded_rectangle.js +28 -0
  106. package/src/phaser/util/math.js +279 -0
  107. package/src/phaser/util/string.js +26 -0
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @author Andras Csizmadia <andras@vpmedia.hu>
3
+ * @author Richard Davey <rich@photonstorm.com>
4
+ * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
5
+ */
6
+ import { clone } from './graphics_data_util';
7
+
8
+ export default class {
9
+
10
+ constructor(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) {
11
+ this.lineWidth = lineWidth;
12
+ this.lineColor = lineColor;
13
+ this.lineAlpha = lineAlpha;
14
+ this._lineTint = lineColor;
15
+ this.fillColor = fillColor;
16
+ this.fillAlpha = fillAlpha;
17
+ this._fillTint = fillColor;
18
+ this.fill = fill;
19
+ this.shape = shape;
20
+ this.type = shape.type;
21
+ }
22
+
23
+ clone() {
24
+ return clone(this);
25
+ }
26
+
27
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @author Andras Csizmadia <andras@vpmedia.hu>
3
+ * @author Richard Davey <rich@photonstorm.com>
4
+ * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
5
+ */
6
+ import GraphicsData from './graphics_data';
7
+
8
+ /**
9
+ *
10
+ * @param source
11
+ */
12
+ export function clone(source) {
13
+ return new GraphicsData(source.lineWidth, source.lineColor, source.lineAlpha, source.fillColor, source.fillAlpha, source.fill, source.shape);
14
+ }
@@ -0,0 +1,227 @@
1
+ /**
2
+ * @author Andras Csizmadia <andras@vpmedia.hu>
3
+ * @author Richard Davey <rich@photonstorm.com>
4
+ * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
5
+ */
6
+ import DisplayObject from './display_object';
7
+ import Image from './image';
8
+ import Signal from '../core/signal';
9
+ import { GROUP } from '../core/const';
10
+
11
+ export const SORT_ASCENDING = -1;
12
+ export const SORT_DESCENDING = 1;
13
+
14
+ export default class extends DisplayObject {
15
+
16
+ constructor(game, parent = null, name = 'group', addToStage = false) {
17
+ super();
18
+ this.game = game;
19
+ this.type = GROUP;
20
+ if (!parent) {
21
+ parent = game.world;
22
+ }
23
+ this.name = name || 'group';
24
+ this.z = 0;
25
+ if (addToStage) {
26
+ this.game.stage.addChild(this);
27
+ this.z = this.game.stage.children.length;
28
+ } else if (parent) {
29
+ parent.addChild(this);
30
+ this.z = parent.children.length;
31
+ }
32
+ this.ignoreDestroy = false;
33
+ this.pendingDestroy = false;
34
+ this.classType = Image;
35
+ this.cursor = null;
36
+ this.inputEnableChildren = false;
37
+ this.onChildInputDown = new Signal();
38
+ this.onChildInputUp = new Signal();
39
+ this.onChildInputOver = new Signal();
40
+ this.onChildInputOut = new Signal();
41
+ this.onDestroy = new Signal();
42
+ this.cursorIndex = 0;
43
+ this._sortProperty = 'z';
44
+ }
45
+
46
+ destroy(destroyChildren = true, soft = false) {
47
+ if (this.game === null || this.ignoreDestroy) {
48
+ return;
49
+ }
50
+ this.onDestroy.dispatch(this, destroyChildren, soft);
51
+ this.removeAll(destroyChildren);
52
+ this.cursor = null;
53
+ this.filters = null;
54
+ this.pendingDestroy = false;
55
+ if (!soft) {
56
+ if (this.parent) {
57
+ this.parent.removeChild(this);
58
+ }
59
+ this.game = null;
60
+ this.exists = false;
61
+ }
62
+ }
63
+
64
+ add(child, silent = false, index = -1) {
65
+ if (child.parent === this) {
66
+ return child;
67
+ }
68
+ if (index === -1) {
69
+ child.z = this.children.length;
70
+ this.addChild(child);
71
+ } else {
72
+ this.addChildAt(child, index);
73
+ this.updateZ();
74
+ }
75
+ if (this.inputEnableChildren && (!child.input || child.inputEnabled)) {
76
+ child.inputEnabled = true;
77
+ }
78
+ if (!silent && child.events) {
79
+ child.events.onAddedToGroup$dispatch(child, this);
80
+ }
81
+ if (this.cursor === null) {
82
+ this.cursor = child;
83
+ }
84
+ return child;
85
+ }
86
+
87
+ addAt(child, index, silent) {
88
+ this.add(child, silent, index);
89
+ }
90
+
91
+ getAt(index) {
92
+ if (index < 0 || index >= this.children.length) {
93
+ return -1;
94
+ }
95
+ return this.getChildAt(index);
96
+ }
97
+
98
+ updateZ() {
99
+ let i = this.children.length;
100
+ while (i) {
101
+ i -= 1;
102
+ this.children[i].z = i;
103
+ }
104
+ }
105
+
106
+ next() {
107
+ if (this.cursor) {
108
+ // Wrap the cursor?
109
+ if (this.cursorIndex >= this.children.length - 1) {
110
+ this.cursorIndex = 0;
111
+ } else {
112
+ this.cursorIndex += 1;
113
+ }
114
+ this.cursor = this.children[this.cursorIndex];
115
+ return this.cursor;
116
+ }
117
+ return null;
118
+ }
119
+
120
+ previous() {
121
+ if (this.cursor) {
122
+ // Wrap the cursor?
123
+ if (this.cursorIndex === 0) {
124
+ this.cursorIndex = this.children.length - 1;
125
+ } else {
126
+ this.cursorIndex -= 1;
127
+ }
128
+ this.cursor = this.children[this.cursorIndex];
129
+ return this.cursor;
130
+ }
131
+ return null;
132
+ }
133
+
134
+ swap(child1, child2) {
135
+ this.swapChildren(child1, child2);
136
+ this.updateZ();
137
+ }
138
+
139
+ bringToTop(child) {
140
+ if (child.parent === this && this.getIndex(child) < this.children.length) {
141
+ this.remove(child, false, true);
142
+ this.add(child, true);
143
+ }
144
+ return child;
145
+ }
146
+
147
+ sendToBack(child) {
148
+ if (child.parent === this && this.getIndex(child) > 0) {
149
+ this.remove(child, false, true);
150
+ this.addAt(child, 0, true);
151
+ }
152
+ return child;
153
+ }
154
+
155
+ reverse() {
156
+ this.children.reverse();
157
+ this.updateZ();
158
+ }
159
+
160
+ getIndex(child) {
161
+ return this.children.indexOf(child);
162
+ }
163
+
164
+ preUpdate() {
165
+ if (this.pendingDestroy) {
166
+ this.destroy();
167
+ return;
168
+ }
169
+ if (!this.exists || !this.parent.exists) {
170
+ this.renderOrderID = -1;
171
+ return;
172
+ }
173
+ for (let i = 0; i < this.children.length; i += 1) {
174
+ this.children[i].preUpdate();
175
+ }
176
+ }
177
+
178
+ update() {
179
+ let i = this.children.length;
180
+ while (i) {
181
+ i -= 1;
182
+ this.children[i].update();
183
+ }
184
+ }
185
+
186
+ postUpdate() {
187
+ for (let i = 0; i < this.children.length; i += 1) {
188
+ this.children[i].postUpdate();
189
+ }
190
+ }
191
+
192
+ remove(child, destroy = true, silent = false) {
193
+ if (this.children.length === 0 || this.children.indexOf(child) === -1) {
194
+ return false;
195
+ }
196
+ if (!silent && child.events && !child.destroyPhase) {
197
+ child.events.onRemovedFromGroup$dispatch(child, this);
198
+ }
199
+ const removed = this.removeChild(child);
200
+ this.updateZ();
201
+ if (this.cursor === child) {
202
+ this.next();
203
+ }
204
+ if (destroy && removed) {
205
+ removed.destroy(true);
206
+ }
207
+ return true;
208
+ }
209
+
210
+ removeAll(destroy = true, silent = false, destroyTexture = false) {
211
+ if (this.children.length === 0) {
212
+ return;
213
+ }
214
+ do {
215
+ if (!silent && this.children[0].events) {
216
+ this.children[0].events.onRemovedFromGroup$dispatch(this.children[0], this);
217
+ }
218
+ const removed = this.removeChild(this.children[0]);
219
+ if (destroy && removed) {
220
+ removed.destroy(true, destroyTexture);
221
+ }
222
+ }
223
+ while (this.children.length > 0);
224
+ this.cursor = null;
225
+ }
226
+
227
+ }
@@ -0,0 +1,288 @@
1
+ /**
2
+ * @author Andras Csizmadia <andras@vpmedia.hu>
3
+ * @author Richard Davey <rich@photonstorm.com>
4
+ * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
5
+ */
6
+ import Texture from './webgl/texture';
7
+ import AnimationManager from '../core/animation_manager';
8
+ import EventManager from '../core/event_manager';
9
+ import Rectangle from '../geom/rectangle';
10
+ import DisplayObject from './display_object';
11
+ import { clone } from '../geom/util/rectangle';
12
+ import { IMAGE, PENDING_ATLAS, BLEND_NORMAL } from '../core/const';
13
+ import { setTexture, getBounds, getLocalBounds, renderCanvas, renderWebGL } from './sprite_util';
14
+
15
+ export default class extends DisplayObject {
16
+
17
+ constructor(game, x, y, key, frame) {
18
+ super();
19
+ this.game = game;
20
+ this.type = IMAGE;
21
+ this.renderable = true;
22
+ this.key = key;
23
+ this.texture = window.PhaserRegistry.CACHE_MISSING_IMAGE;
24
+ this.data = {};
25
+ this._width = 0;
26
+ this._height = 0;
27
+ this.tint = 0xFFFFFF;
28
+ this.cachedTint = -1;
29
+ this.tintedTexture = null;
30
+ this.blendMode = BLEND_NORMAL;
31
+ this.shader = null;
32
+ this._frame = null;
33
+ /* if (this.texture.baseTexture.hasLoaded) {
34
+ this.onTextureUpdate();
35
+ } */
36
+ this.position.set(x, y);
37
+ this.events = new EventManager(this);
38
+ this.animations = new AnimationManager(this);
39
+ this.loadTexture(key, frame);
40
+ }
41
+
42
+ destroy() {
43
+ this.game = null;
44
+ this.key = null;
45
+ this.data = null;
46
+ this.texture = null;
47
+ this.tint = 0xFFFFFF;
48
+ this.cachedTint = -1;
49
+ this.tintedTexture = null;
50
+ this.shader = null;
51
+ this._frame = null;
52
+ if (this.events) {
53
+ this.events.destroy();
54
+ }
55
+ this.events = null;
56
+ if (this.animations) {
57
+ this.animations.destroy();
58
+ }
59
+ this.animations = null;
60
+ super.destroy();
61
+ }
62
+
63
+ preUpdate() {
64
+ if (this.pendingDestroy) {
65
+ this.destroy();
66
+ return;
67
+ }
68
+ if (!this.exists || !this.parent.exists) {
69
+ this.renderOrderID = -1;
70
+ return;
71
+ }
72
+ if (this.visible) {
73
+ this.game.stage.currentRenderOrderID += 1;
74
+ this.renderOrderID = this.game.stage.currentRenderOrderID;
75
+ }
76
+ if (this.animations) {
77
+ this.animations.update();
78
+ }
79
+ for (let i = 0; i < this.children.length; i += 1) {
80
+ this.children[i].preUpdate();
81
+ }
82
+ }
83
+
84
+ // LoadTexture
85
+
86
+ loadTexture(key, frame = 0, stopAnimation = true) {
87
+ if (key === PENDING_ATLAS) {
88
+ key = frame;
89
+ frame = 0;
90
+ } else {
91
+ frame = frame || 0;
92
+ }
93
+ if (stopAnimation) {
94
+ this.animations.stop();
95
+ }
96
+ this.key = key;
97
+ this.customRender = false;
98
+ const cache = this.game.cache;
99
+ const smoothed = !this.texture.baseTexture.scaleMode;
100
+ let setFrame = true;
101
+ if (key instanceof Texture) {
102
+ this.setTexture(key);
103
+ } else {
104
+ const img = cache.getImage(key, true);
105
+ if (img) {
106
+ this.key = img.key;
107
+ this.setTexture(new Texture(img.base));
108
+ if (key === '__default') {
109
+ this.texture.baseTexture.skipRender = true;
110
+ } else {
111
+ this.texture.baseTexture.skipRender = false;
112
+ }
113
+ setFrame = !this.animations.loadFrameData(img.frameData, frame);
114
+ }
115
+ }
116
+ if (setFrame) {
117
+ this._frame = clone(this.texture.frame);
118
+ }
119
+ if (!smoothed) {
120
+ this.texture.baseTexture.scaleMode = 1;
121
+ }
122
+ }
123
+
124
+ setFrame(frame) {
125
+ this._frame = frame;
126
+ this.texture.frame.x = frame.x;
127
+ this.texture.frame.y = frame.y;
128
+ this.texture.frame.width = frame.width;
129
+ this.texture.frame.height = frame.height;
130
+ this.texture.crop.x = frame.x;
131
+ this.texture.crop.y = frame.y;
132
+ this.texture.crop.width = frame.width;
133
+ this.texture.crop.height = frame.height;
134
+ if (frame.trimmed) {
135
+ if (this.texture.trim) {
136
+ this.texture.trim.x = frame.spriteSourceSizeX;
137
+ this.texture.trim.y = frame.spriteSourceSizeY;
138
+ this.texture.trim.width = frame.sourceSizeW;
139
+ this.texture.trim.height = frame.sourceSizeH;
140
+ } else {
141
+ this.texture.trim = {
142
+ x: frame.spriteSourceSizeX,
143
+ y: frame.spriteSourceSizeY,
144
+ width: frame.sourceSizeW,
145
+ height: frame.sourceSizeH,
146
+ };
147
+ }
148
+ this.texture.width = frame.sourceSizeW;
149
+ this.texture.height = frame.sourceSizeH;
150
+ this.texture.frame.width = frame.sourceSizeW;
151
+ this.texture.frame.height = frame.sourceSizeH;
152
+ } else if (!frame.trimmed && this.texture.trim) {
153
+ this.texture.trim = null;
154
+ }
155
+ if (this.cropRect) {
156
+ this.updateCrop();
157
+ }
158
+ this.texture.requiresReTint = true;
159
+ this.texture._updateUvs();
160
+ if (this.tilingTexture) {
161
+ this.refreshTexture = true;
162
+ }
163
+ }
164
+
165
+ resizeFrame(parent, width, height) {
166
+ this.texture.frame.resize(width, height);
167
+ this.texture.setFrame(this.texture.frame);
168
+ }
169
+
170
+ resetFrame() {
171
+ if (this._frame) {
172
+ this.setFrame(this._frame);
173
+ }
174
+ }
175
+
176
+ get frame() {
177
+ return this.animations.frame;
178
+ }
179
+
180
+ set frame(value) {
181
+ this.animations.frame = value;
182
+ }
183
+
184
+ get frameName() {
185
+ return this.animations.frameName;
186
+ }
187
+
188
+ set frameName(value) {
189
+ this.animations.frameName = value;
190
+ }
191
+
192
+ // Crop
193
+
194
+ crop(rect, copy = false) {
195
+ if (rect) {
196
+ if (copy && this.cropRect !== null) {
197
+ this.cropRect.setTo(rect.x, rect.y, rect.width, rect.height);
198
+ } else if (copy && this.cropRect === null) {
199
+ this.cropRect = new Rectangle(rect.x, rect.y, rect.width, rect.height);
200
+ } else {
201
+ this.cropRect = rect;
202
+ }
203
+ this.updateCrop();
204
+ } else {
205
+ this._crop = null;
206
+ this.cropRect = null;
207
+ this.resetFrame();
208
+ }
209
+ }
210
+
211
+ updateCrop() {
212
+ if (!this.cropRect) {
213
+ return;
214
+ }
215
+ const oldX = this.texture.crop.x;
216
+ const oldY = this.texture.crop.y;
217
+ const oldW = this.texture.crop.width;
218
+ const oldH = this.texture.crop.height;
219
+ this._crop = clone(this.cropRect, this._crop);
220
+ this._crop.x += this._frame.x;
221
+ this._crop.y += this._frame.y;
222
+ const cx = Math.max(this._frame.x, this._crop.x);
223
+ const cy = Math.max(this._frame.y, this._crop.y);
224
+ const cw = Math.min(this._frame.right, this._crop.right) - cx;
225
+ const ch = Math.min(this._frame.bottom, this._crop.bottom) - cy;
226
+ this.texture.crop.x = cx;
227
+ this.texture.crop.y = cy;
228
+ this.texture.crop.width = cw;
229
+ this.texture.crop.height = ch;
230
+ this.texture.frame.width = Math.min(cw, this.cropRect.width);
231
+ this.texture.frame.height = Math.min(ch, this.cropRect.height);
232
+ this.texture.width = this.texture.frame.width;
233
+ this.texture.height = this.texture.frame.height;
234
+ this.texture._updateUvs();
235
+ if (this.tint !== 0xffffff && (oldX !== cx || oldY !== cy || oldW !== cw || oldH !== ch)) {
236
+ this.texture.requiresReTint = true;
237
+ }
238
+ }
239
+
240
+ get width() {
241
+ return this.scale.x * this.texture.frame.width;
242
+ }
243
+
244
+ set width(value) {
245
+ this.scale.x = value / this.texture.frame.width;
246
+ this._width = value;
247
+ }
248
+
249
+ get height() {
250
+ return this.scale.y * this.texture.frame.height;
251
+ }
252
+
253
+ set height(value) {
254
+ this.scale.y = value / this.texture.frame.height;
255
+ this._height = value;
256
+ }
257
+
258
+ onTextureUpdate() {
259
+ // so if _width is 0 then width was not set..
260
+ if (this._width) {
261
+ this.scale.x = this._width / this.texture.frame.width;
262
+ }
263
+ if (this._height) {
264
+ this.scale.y = this._height / this.texture.frame.height;
265
+ }
266
+ }
267
+
268
+ setTexture(texture, destroyBase = false) {
269
+ setTexture(this, texture, destroyBase);
270
+ }
271
+
272
+ getBounds(matrix = null) {
273
+ return getBounds(this, matrix);
274
+ }
275
+
276
+ getLocalBounds() {
277
+ return getLocalBounds(this);
278
+ }
279
+
280
+ renderWebGL(renderSession, matrix = null) {
281
+ renderWebGL(this, renderSession, matrix);
282
+ }
283
+
284
+ renderCanvas(renderSession, matrix = null) {
285
+ renderCanvas(this, renderSession, matrix);
286
+ }
287
+
288
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @author Andras Csizmadia <andras@vpmedia.hu>
3
+ * @author Richard Davey <rich@photonstorm.com>
4
+ * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
5
+ */
6
+ import DisplayObject from './display_object';
7
+
8
+ export default class extends DisplayObject {
9
+
10
+ constructor(game) {
11
+ super();
12
+ this.game = game;
13
+ }
14
+
15
+ }