@vpmedia/phaser 1.104.0 → 1.105.0
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/dist/index.js +151 -574
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts +35 -57
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +11 -10
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts +2 -2
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts +3 -3
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +60 -60
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/device.d.ts.map +1 -1
- package/dist/phaser/core/device_util.d.ts +10 -10
- package/dist/phaser/core/device_util.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts +6 -5
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/event_manager.d.ts +49 -174
- package/dist/phaser/core/event_manager.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts +7 -7
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/frame.d.ts +27 -48
- package/dist/phaser/core/frame.d.ts.map +1 -1
- package/dist/phaser/core/frame_data.d.ts +11 -60
- package/dist/phaser/core/frame_data.d.ts.map +1 -1
- package/dist/phaser/core/frame_util.d.ts +4 -14
- package/dist/phaser/core/frame_util.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts +49 -58
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +15 -13
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +23 -20
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts +26 -1
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts +2 -2
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +9 -9
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts +2 -1
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +28 -28
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +4 -4
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts +2 -2
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/scale_manager.d.ts +22 -17
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts +1 -1
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts +10 -9
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts +9 -8
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts +2 -2
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +56 -101
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +11 -9
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts +4 -4
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts +3 -3
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts +5 -5
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +10 -10
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/timer_event.d.ts +11 -21
- package/dist/phaser/core/timer_event.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts +37 -59
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +6 -5
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_easing.d.ts +31 -31
- package/dist/phaser/core/tween_easing.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts +4 -4
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts +1 -1
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts +22 -20
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts +23 -35
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts +2 -2
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/graphics.d.ts +3 -3
- package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
- package/dist/phaser/display/canvas/pool.d.ts +2 -2
- package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
- package/dist/phaser/display/canvas/renderer.d.ts +5 -5
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +3 -3
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts +9 -9
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +45 -42
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts +24 -16
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts +24 -37
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +34 -49
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_batch.d.ts +1 -1
- package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts +5 -5
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts +86 -66
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts +2 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/base_texture.d.ts +2 -2
- package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts +3 -2
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts +10 -10
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +2 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts +2 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts +3 -2
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +11 -10
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts +2 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts +2 -1
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts +8 -6
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts +1 -0
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts +2 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts +4 -2
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts +3 -2
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts +5 -4
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts +15 -2
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts +6 -6
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts +11 -10
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts +6 -5
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts +14 -14
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts +13 -12
- package/dist/phaser/geom/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/point.d.ts +19 -19
- package/dist/phaser/geom/point.d.ts.map +1 -1
- package/dist/phaser/geom/polygon.d.ts +6 -6
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts +20 -20
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/rounded_rectangle.d.ts +2 -2
- package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts +9 -7
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts +5 -3
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts +2 -1
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts +19 -19
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/polygon.d.ts +2 -1
- package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +17 -15
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts +2 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/util/math.d.ts +51 -142
- package/dist/phaser/util/math.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/phaser/core/animation.ts +38 -61
- package/src/phaser/core/animation_manager.ts +21 -21
- package/src/phaser/core/animation_parser.ts +11 -3
- package/src/phaser/core/array_set.ts +8 -8
- package/src/phaser/core/cache.ts +75 -68
- package/src/phaser/core/device.ts +23 -24
- package/src/phaser/core/device_util.ts +10 -10
- package/src/phaser/core/dom.ts +5 -5
- package/src/phaser/core/event_manager.ts +52 -193
- package/src/phaser/core/factory.ts +25 -18
- package/src/phaser/core/frame.ts +37 -51
- package/src/phaser/core/frame_data.ts +29 -76
- package/src/phaser/core/frame_util.ts +3 -16
- package/src/phaser/core/game.ts +36 -63
- package/src/phaser/core/input.ts +68 -68
- package/src/phaser/core/input_handler.ts +81 -86
- package/src/phaser/core/input_mouse.ts +42 -36
- package/src/phaser/core/input_mspointer.ts +24 -25
- package/src/phaser/core/input_pointer.ts +55 -56
- package/src/phaser/core/input_touch.ts +26 -26
- package/src/phaser/core/loader.ts +97 -70
- package/src/phaser/core/loader_parser.ts +6 -7
- package/src/phaser/core/raf.ts +2 -2
- package/src/phaser/core/scale_manager.ts +85 -82
- package/src/phaser/core/scene.ts +3 -4
- package/src/phaser/core/scene_manager.ts +26 -26
- package/src/phaser/core/signal.ts +10 -10
- package/src/phaser/core/signal_binding.ts +2 -2
- package/src/phaser/core/sound.ts +65 -112
- package/src/phaser/core/sound_manager.ts +31 -30
- package/src/phaser/core/sound_sprite.ts +10 -11
- package/src/phaser/core/stage.ts +8 -8
- package/src/phaser/core/time.ts +33 -34
- package/src/phaser/core/timer.ts +40 -34
- package/src/phaser/core/timer_event.ts +23 -23
- package/src/phaser/core/tween.ts +42 -68
- package/src/phaser/core/tween_data.ts +31 -31
- package/src/phaser/core/tween_easing.ts +31 -31
- package/src/phaser/core/tween_manager.ts +10 -11
- package/src/phaser/core/world.ts +1 -2
- package/src/phaser/display/bitmap_text.ts +41 -31
- package/src/phaser/display/button.ts +24 -51
- package/src/phaser/display/canvas/buffer.ts +6 -7
- package/src/phaser/display/canvas/graphics.ts +3 -4
- package/src/phaser/display/canvas/masker.ts +2 -3
- package/src/phaser/display/canvas/pool.ts +3 -4
- package/src/phaser/display/canvas/renderer.ts +19 -20
- package/src/phaser/display/canvas/tinter.ts +4 -5
- package/src/phaser/display/canvas/util.ts +9 -9
- package/src/phaser/display/display_object.ts +49 -50
- package/src/phaser/display/graphics.ts +56 -43
- package/src/phaser/display/graphics_data.ts +11 -12
- package/src/phaser/display/graphics_data_util.ts +1 -2
- package/src/phaser/display/group.ts +32 -42
- package/src/phaser/display/image.ts +32 -52
- package/src/phaser/display/sprite_batch.ts +1 -2
- package/src/phaser/display/sprite_util.ts +5 -6
- package/src/phaser/display/text.ts +82 -56
- package/src/phaser/display/webgl/abstract_filter.ts +8 -8
- package/src/phaser/display/webgl/base_texture.ts +14 -15
- package/src/phaser/display/webgl/blend_manager.ts +5 -5
- package/src/phaser/display/webgl/earcut.ts +27 -27
- package/src/phaser/display/webgl/earcut_node.ts +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.ts +19 -19
- package/src/phaser/display/webgl/filter_manager.ts +5 -5
- package/src/phaser/display/webgl/filter_texture.ts +7 -7
- package/src/phaser/display/webgl/graphics.ts +10 -11
- package/src/phaser/display/webgl/graphics_data.ts +11 -11
- package/src/phaser/display/webgl/mask_manager.ts +2 -3
- package/src/phaser/display/webgl/render_texture.ts +12 -12
- package/src/phaser/display/webgl/renderer.ts +24 -24
- package/src/phaser/display/webgl/shader/complex.ts +7 -7
- package/src/phaser/display/webgl/shader/fast.ts +8 -8
- package/src/phaser/display/webgl/shader/normal.ts +12 -12
- package/src/phaser/display/webgl/shader/primitive.ts +7 -7
- package/src/phaser/display/webgl/shader/strip.ts +7 -7
- package/src/phaser/display/webgl/shader_manager.ts +13 -13
- package/src/phaser/display/webgl/sprite_batch.ts +20 -20
- package/src/phaser/display/webgl/stencil_manager.ts +8 -8
- package/src/phaser/display/webgl/texture.ts +35 -24
- package/src/phaser/display/webgl/texture_util.ts +2 -3
- package/src/phaser/display/webgl/util.ts +6 -6
- package/src/phaser/geom/circle.ts +10 -10
- package/src/phaser/geom/ellipse.ts +6 -6
- package/src/phaser/geom/line.ts +14 -14
- package/src/phaser/geom/matrix.ts +12 -12
- package/src/phaser/geom/point.ts +19 -19
- package/src/phaser/geom/polygon.ts +5 -5
- package/src/phaser/geom/rectangle.ts +21 -21
- package/src/phaser/geom/rounded_rectangle.ts +2 -2
- package/src/phaser/geom/util/circle.ts +7 -7
- package/src/phaser/geom/util/ellipse.ts +1 -1
- package/src/phaser/geom/util/line.ts +5 -5
- package/src/phaser/geom/util/matrix.ts +1 -1
- package/src/phaser/geom/util/point.ts +20 -20
- package/src/phaser/geom/util/polygon.ts +1 -1
- package/src/phaser/geom/util/rectangle.ts +15 -15
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
- package/src/phaser/util/math.ts +65 -151
package/src/phaser/core/dom.ts
CHANGED
|
@@ -191,7 +191,7 @@ export class DOM {
|
|
|
191
191
|
* TBD.
|
|
192
192
|
* @param {import('./device.js').Device} device - TBD.
|
|
193
193
|
*/
|
|
194
|
-
constructor(device) {
|
|
194
|
+
constructor(device: import('./device.js').Device) {
|
|
195
195
|
this.treatAsDesktop =
|
|
196
196
|
device.desktop &&
|
|
197
197
|
document.documentElement.clientWidth <= window.innerWidth &&
|
|
@@ -211,7 +211,7 @@ export class DOM {
|
|
|
211
211
|
* @param {Point} point - Optional Point object to store the result.
|
|
212
212
|
* @returns {Point} The offset position of the element.
|
|
213
213
|
*/
|
|
214
|
-
getOffset(element, point = null) {
|
|
214
|
+
getOffset(element: HTMLCanvasElement, point: Point = null) {
|
|
215
215
|
point = point || new Point();
|
|
216
216
|
const box = element.getBoundingClientRect();
|
|
217
217
|
const scrollTop = this.scrollY;
|
|
@@ -229,7 +229,7 @@ export class DOM {
|
|
|
229
229
|
* @param {number} cushion - Optional padding to add around the element.
|
|
230
230
|
* @returns {boolean} True if bounds were successfully retrieved, false otherwise.
|
|
231
231
|
*/
|
|
232
|
-
getBounds(element, cushion = 0) {
|
|
232
|
+
getBounds(element: HTMLCanvasElement, cushion: number = 0) {
|
|
233
233
|
element = element && !element.nodeType ? element[0] : element;
|
|
234
234
|
if (!element || element.nodeType !== 1) {
|
|
235
235
|
return false;
|
|
@@ -243,7 +243,7 @@ export class DOM {
|
|
|
243
243
|
* @param {number} cushion - Optional padding to add around the rectangle.
|
|
244
244
|
* @returns {{width: number, height: number, left: number, right: number, top: number, bottom: number}} The calibrated rectangle.
|
|
245
245
|
*/
|
|
246
|
-
calibrate(coords, cushion = 0) {
|
|
246
|
+
calibrate(coords: DOMRect, cushion: number = 0) {
|
|
247
247
|
const output = {
|
|
248
248
|
width: 0,
|
|
249
249
|
height: 0,
|
|
@@ -262,7 +262,7 @@ export class DOM {
|
|
|
262
262
|
* @param {string} primaryFallback - The fallback method to use if screen orientation API is not available.
|
|
263
263
|
* @returns {string} The screen orientation ('portrait-primary', 'landscape-primary', etc.).
|
|
264
264
|
*/
|
|
265
|
-
getScreenOrientation(primaryFallback) {
|
|
265
|
+
getScreenOrientation(primaryFallback: string) {
|
|
266
266
|
const screen = window.screen;
|
|
267
267
|
// @ts-ignore
|
|
268
268
|
const orientation = screen.orientation || screen.mozOrientation || screen.msOrientation;
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
import type { DisplayObject } from '../display/display_object.js';
|
|
2
2
|
import { Signal } from './signal.js';
|
|
3
3
|
|
|
4
4
|
export class EventManager {
|
|
5
|
-
parent;
|
|
6
|
-
_onAddedToGroup;
|
|
7
|
-
_onRemovedFromGroup;
|
|
8
|
-
_onDestroy;
|
|
9
|
-
_onOutOfBounds;
|
|
10
|
-
_onEnterBounds;
|
|
11
|
-
_onInputOver;
|
|
12
|
-
_onInputOut;
|
|
13
|
-
_onInputDown;
|
|
14
|
-
_onInputUp;
|
|
15
|
-
_onDragStart;
|
|
16
|
-
_onDragUpdate;
|
|
17
|
-
_onDragStop;
|
|
18
|
-
_onAnimationStart;
|
|
19
|
-
_onAnimationComplete;
|
|
20
|
-
_onAnimationLoop;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
* @param {import('../display/display_object.js').DisplayObject} sprite - Reference to the parent DisplayObject.
|
|
24
|
-
*/
|
|
25
|
-
constructor(sprite) {
|
|
5
|
+
parent: DisplayObject | null;
|
|
6
|
+
_onAddedToGroup: Signal | null;
|
|
7
|
+
_onRemovedFromGroup: Signal | null;
|
|
8
|
+
_onDestroy: Signal | null;
|
|
9
|
+
_onOutOfBounds: Signal | null;
|
|
10
|
+
_onEnterBounds: Signal | null;
|
|
11
|
+
_onInputOver: Signal | null;
|
|
12
|
+
_onInputOut: Signal | null;
|
|
13
|
+
_onInputDown: Signal | null;
|
|
14
|
+
_onInputUp: Signal | null;
|
|
15
|
+
_onDragStart: Signal | null;
|
|
16
|
+
_onDragUpdate: Signal | null;
|
|
17
|
+
_onDragStop: Signal | null;
|
|
18
|
+
_onAnimationStart: Signal | null;
|
|
19
|
+
_onAnimationComplete: Signal | null;
|
|
20
|
+
_onAnimationLoop: Signal | null;
|
|
21
|
+
|
|
22
|
+
constructor(sprite: DisplayObject) {
|
|
26
23
|
this.parent = sprite;
|
|
27
24
|
this._onAddedToGroup = null;
|
|
28
25
|
this._onRemovedFromGroup = null;
|
|
@@ -41,11 +38,8 @@ _onAnimationLoop;
|
|
|
41
38
|
this._onAnimationLoop = null;
|
|
42
39
|
}
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*/
|
|
47
|
-
destroy() {
|
|
48
|
-
this._parent = null;
|
|
41
|
+
destroy(): void {
|
|
42
|
+
this.parent = null;
|
|
49
43
|
if (this._onDestroy) {
|
|
50
44
|
this._onDestroy.dispose();
|
|
51
45
|
}
|
|
@@ -93,318 +87,183 @@ _onAnimationLoop;
|
|
|
93
87
|
}
|
|
94
88
|
}
|
|
95
89
|
|
|
96
|
-
|
|
97
|
-
* Gets the onAddedToGroup signal.
|
|
98
|
-
* @returns {Signal} The Signal object for the onAddedToGroup event.
|
|
99
|
-
*/
|
|
100
|
-
get onAddedToGroup() {
|
|
90
|
+
get onAddedToGroup(): Signal {
|
|
101
91
|
if (!this._onAddedToGroup) {
|
|
102
92
|
this._onAddedToGroup = new Signal();
|
|
103
93
|
}
|
|
104
94
|
return this._onAddedToGroup;
|
|
105
95
|
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Dispatches the onAddedToGroup event.
|
|
109
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
110
|
-
*/
|
|
111
|
-
onAddedToGroup$dispatch(...args) {
|
|
96
|
+
onAddedToGroup$dispatch(...args: unknown[]): void {
|
|
112
97
|
if (this._onAddedToGroup) {
|
|
113
98
|
this._onAddedToGroup.dispatch(...args);
|
|
114
99
|
}
|
|
115
100
|
}
|
|
116
101
|
|
|
117
|
-
|
|
118
|
-
* Gets the onRemovedFromGroup signal.
|
|
119
|
-
* @returns {Signal} The Signal object for the onRemovedFromGroup event.
|
|
120
|
-
*/
|
|
121
|
-
get onRemovedFromGroup() {
|
|
102
|
+
get onRemovedFromGroup(): Signal {
|
|
122
103
|
if (!this._onRemovedFromGroup) {
|
|
123
104
|
this._onRemovedFromGroup = new Signal();
|
|
124
105
|
}
|
|
125
106
|
return this._onRemovedFromGroup;
|
|
126
107
|
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Dispatches the onRemovedFromGroup event.
|
|
130
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
131
|
-
*/
|
|
132
|
-
onRemovedFromGroup$dispatch(...args) {
|
|
108
|
+
onRemovedFromGroup$dispatch(...args: unknown[]): void {
|
|
133
109
|
if (this._onRemovedFromGroup) {
|
|
134
110
|
this._onRemovedFromGroup.dispatch(...args);
|
|
135
111
|
}
|
|
136
112
|
}
|
|
137
113
|
|
|
138
|
-
|
|
139
|
-
* Gets the onDestroy signal.
|
|
140
|
-
* @returns {Signal} The Signal object for the onDestroy event.
|
|
141
|
-
*/
|
|
142
|
-
get onDestroy() {
|
|
114
|
+
get onDestroy(): Signal {
|
|
143
115
|
if (!this._onDestroy) {
|
|
144
116
|
this._onDestroy = new Signal();
|
|
145
117
|
}
|
|
146
118
|
return this._onDestroy;
|
|
147
119
|
}
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Dispatches the onDestroy event.
|
|
151
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
152
|
-
*/
|
|
153
|
-
onDestroy$dispatch(...args) {
|
|
120
|
+
onDestroy$dispatch(...args: unknown[]): void {
|
|
154
121
|
if (this._onDestroy) {
|
|
155
122
|
this._onDestroy.dispatch(...args);
|
|
156
123
|
}
|
|
157
124
|
}
|
|
158
125
|
|
|
159
|
-
|
|
160
|
-
* Gets the onOutOfBounds signal.
|
|
161
|
-
* @returns {Signal} The Signal object for the onOutOfBounds event.
|
|
162
|
-
*/
|
|
163
|
-
get onOutOfBounds() {
|
|
126
|
+
get onOutOfBounds(): Signal {
|
|
164
127
|
if (!this._onOutOfBounds) {
|
|
165
128
|
this._onOutOfBounds = new Signal();
|
|
166
129
|
}
|
|
167
130
|
return this._onOutOfBounds;
|
|
168
131
|
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* Dispatches the onOutOfBounds event.
|
|
172
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
173
|
-
*/
|
|
174
|
-
onOutOfBounds$dispatch(...args) {
|
|
132
|
+
onOutOfBounds$dispatch(...args: unknown[]): void {
|
|
175
133
|
if (this._onOutOfBounds) {
|
|
176
134
|
this._onOutOfBounds.dispatch(...args);
|
|
177
135
|
}
|
|
178
136
|
}
|
|
179
137
|
|
|
180
|
-
|
|
181
|
-
* Gets the onEnterBounds signal.
|
|
182
|
-
* @returns {Signal} The Signal object for the onEnterBounds event.
|
|
183
|
-
*/
|
|
184
|
-
get onEnterBounds() {
|
|
138
|
+
get onEnterBounds(): Signal {
|
|
185
139
|
if (!this._onEnterBounds) {
|
|
186
140
|
this._onEnterBounds = new Signal();
|
|
187
141
|
}
|
|
188
142
|
return this._onEnterBounds;
|
|
189
143
|
}
|
|
190
|
-
|
|
191
|
-
/**
|
|
192
|
-
* Dispatches the onEnterBounds event.
|
|
193
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
194
|
-
*/
|
|
195
|
-
onEnterBounds$dispatch(...args) {
|
|
144
|
+
onEnterBounds$dispatch(...args: unknown[]): void {
|
|
196
145
|
if (this._onEnterBounds) {
|
|
197
146
|
this._onEnterBounds.dispatch(...args);
|
|
198
147
|
}
|
|
199
148
|
}
|
|
200
149
|
|
|
201
|
-
|
|
202
|
-
* Gets the onInputOver signal.
|
|
203
|
-
* @returns {Signal} The Signal object for the onInputOver event.
|
|
204
|
-
*/
|
|
205
|
-
get onInputOver() {
|
|
150
|
+
get onInputOver(): Signal {
|
|
206
151
|
if (!this._onInputOver) {
|
|
207
152
|
this._onInputOver = new Signal();
|
|
208
153
|
}
|
|
209
154
|
return this._onInputOver;
|
|
210
155
|
}
|
|
211
|
-
|
|
212
|
-
/**
|
|
213
|
-
* Dispatches the onInputOver event.
|
|
214
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
215
|
-
*/
|
|
216
|
-
onInputOver$dispatch(...args) {
|
|
156
|
+
onInputOver$dispatch(...args: unknown[]): void {
|
|
217
157
|
if (this._onInputOver) {
|
|
218
158
|
this._onInputOver.dispatch(...args);
|
|
219
159
|
}
|
|
220
160
|
}
|
|
221
161
|
|
|
222
|
-
|
|
223
|
-
* Gets the onInputOut signal.
|
|
224
|
-
* @returns {Signal} The Signal object for the onInputOut event.
|
|
225
|
-
*/
|
|
226
|
-
get onInputOut() {
|
|
162
|
+
get onInputOut(): Signal {
|
|
227
163
|
if (!this._onInputOut) {
|
|
228
164
|
this._onInputOut = new Signal();
|
|
229
165
|
}
|
|
230
166
|
return this._onInputOut;
|
|
231
167
|
}
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Dispatches the onInputOut event.
|
|
235
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
236
|
-
*/
|
|
237
|
-
onInputOut$dispatch(...args) {
|
|
168
|
+
onInputOut$dispatch(...args: unknown[]): void {
|
|
238
169
|
if (this._onInputOut) {
|
|
239
170
|
this._onInputOut.dispatch(...args);
|
|
240
171
|
}
|
|
241
172
|
}
|
|
242
173
|
|
|
243
|
-
|
|
244
|
-
* Gets the onInputDown signal.
|
|
245
|
-
* @returns {Signal} The Signal object for the onInputDown event.
|
|
246
|
-
*/
|
|
247
|
-
get onInputDown() {
|
|
174
|
+
get onInputDown(): Signal {
|
|
248
175
|
if (!this._onInputDown) {
|
|
249
176
|
this._onInputDown = new Signal();
|
|
250
177
|
}
|
|
251
178
|
return this._onInputDown;
|
|
252
179
|
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* Dispatches the onInputDown event.
|
|
256
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
257
|
-
*/
|
|
258
|
-
onInputDown$dispatch(...args) {
|
|
180
|
+
onInputDown$dispatch(...args: unknown[]): void {
|
|
259
181
|
if (this._onInputDown) {
|
|
260
182
|
this._onInputDown.dispatch(...args);
|
|
261
183
|
}
|
|
262
184
|
}
|
|
263
185
|
|
|
264
|
-
|
|
265
|
-
* Gets the onInputUp signal.
|
|
266
|
-
* @returns {Signal} The Signal object for the onInputUp event.
|
|
267
|
-
*/
|
|
268
|
-
get onInputUp() {
|
|
186
|
+
get onInputUp(): Signal {
|
|
269
187
|
if (!this._onInputUp) {
|
|
270
188
|
this._onInputUp = new Signal();
|
|
271
189
|
}
|
|
272
190
|
return this._onInputUp;
|
|
273
191
|
}
|
|
274
|
-
|
|
275
|
-
/**
|
|
276
|
-
* Dispatches the onInputUp event.
|
|
277
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
278
|
-
*/
|
|
279
|
-
onInputUp$dispatch(...args) {
|
|
192
|
+
onInputUp$dispatch(...args: unknown[]): void {
|
|
280
193
|
if (this._onInputUp) {
|
|
281
194
|
this._onInputUp.dispatch(...args);
|
|
282
195
|
}
|
|
283
196
|
}
|
|
284
197
|
|
|
285
|
-
|
|
286
|
-
* Gets the onDragStart signal.
|
|
287
|
-
* @returns {Signal} The Signal object for the onDragStart event.
|
|
288
|
-
*/
|
|
289
|
-
get onDragStart() {
|
|
198
|
+
get onDragStart(): Signal {
|
|
290
199
|
if (!this._onDragStart) {
|
|
291
200
|
this._onDragStart = new Signal();
|
|
292
201
|
}
|
|
293
202
|
return this._onDragStart;
|
|
294
203
|
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* Dispatches the onDragStart event.
|
|
298
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
299
|
-
*/
|
|
300
|
-
onDragStart$dispatch(...args) {
|
|
204
|
+
onDragStart$dispatch(...args: unknown[]): void {
|
|
301
205
|
if (this._onDragStart) {
|
|
302
206
|
this._onDragStart.dispatch(...args);
|
|
303
207
|
}
|
|
304
208
|
}
|
|
305
209
|
|
|
306
|
-
|
|
307
|
-
* Gets the onDragUpdate signal.
|
|
308
|
-
* @returns {Signal} The Signal object for the onDragUpdate event.
|
|
309
|
-
*/
|
|
310
|
-
get onDragUpdate() {
|
|
210
|
+
get onDragUpdate(): Signal {
|
|
311
211
|
if (!this._onDragUpdate) {
|
|
312
212
|
this._onDragUpdate = new Signal();
|
|
313
213
|
}
|
|
314
214
|
return this._onDragUpdate;
|
|
315
215
|
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Dispatches the onDragUpdate event.
|
|
319
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
320
|
-
*/
|
|
321
|
-
onDragUpdate$dispatch(...args) {
|
|
216
|
+
onDragUpdate$dispatch(...args: unknown[]): void {
|
|
322
217
|
if (this._onDragUpdate) {
|
|
323
218
|
this._onDragUpdate.dispatch(...args);
|
|
324
219
|
}
|
|
325
220
|
}
|
|
326
221
|
|
|
327
|
-
|
|
328
|
-
* Gets the onDragStop signal.
|
|
329
|
-
* @returns {Signal} The Signal object for the onDragStop event.
|
|
330
|
-
*/
|
|
331
|
-
get onDragStop() {
|
|
222
|
+
get onDragStop(): Signal {
|
|
332
223
|
if (!this._onDragStop) {
|
|
333
224
|
this._onDragStop = new Signal();
|
|
334
225
|
}
|
|
335
226
|
return this._onDragStop;
|
|
336
227
|
}
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* Dispatches the onDragStop event.
|
|
340
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
341
|
-
*/
|
|
342
|
-
onDragStop$dispatch(...args) {
|
|
228
|
+
onDragStop$dispatch(...args: unknown[]): void {
|
|
343
229
|
if (this._onDragStop) {
|
|
344
230
|
this._onDragStop.dispatch(...args);
|
|
345
231
|
}
|
|
346
232
|
}
|
|
347
233
|
|
|
348
|
-
|
|
349
|
-
* Gets the onAnimationStart signal.
|
|
350
|
-
* @returns {Signal} The Signal object for the onAnimationStart event.
|
|
351
|
-
*/
|
|
352
|
-
get onAnimationStart() {
|
|
234
|
+
get onAnimationStart(): Signal {
|
|
353
235
|
if (!this._onAnimationStart) {
|
|
354
236
|
this._onAnimationStart = new Signal();
|
|
355
237
|
}
|
|
356
238
|
return this._onAnimationStart;
|
|
357
239
|
}
|
|
358
|
-
|
|
359
|
-
/**
|
|
360
|
-
* Dispatches the onAnimationStart event.
|
|
361
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
362
|
-
*/
|
|
363
|
-
onAnimationStart$dispatch(...args) {
|
|
240
|
+
onAnimationStart$dispatch(...args: unknown[]): void {
|
|
364
241
|
if (this._onAnimationStart) {
|
|
365
242
|
this._onAnimationStart.dispatch(...args);
|
|
366
243
|
}
|
|
367
244
|
}
|
|
368
245
|
|
|
369
|
-
|
|
370
|
-
* Gets the onAnimationComplete signal.
|
|
371
|
-
* @returns {Signal} The Signal object for the onAnimationComplete event.
|
|
372
|
-
*/
|
|
373
|
-
get onAnimationComplete() {
|
|
246
|
+
get onAnimationComplete(): Signal {
|
|
374
247
|
if (!this._onAnimationComplete) {
|
|
375
248
|
this._onAnimationComplete = new Signal();
|
|
376
249
|
}
|
|
377
250
|
return this._onAnimationComplete;
|
|
378
251
|
}
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Dispatches the onAnimationComplete event.
|
|
382
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
383
|
-
*/
|
|
384
|
-
onAnimationComplete$dispatch(...args) {
|
|
252
|
+
onAnimationComplete$dispatch(...args: unknown[]): void {
|
|
385
253
|
if (this._onAnimationComplete) {
|
|
386
254
|
this._onAnimationComplete.dispatch(...args);
|
|
387
255
|
}
|
|
388
256
|
}
|
|
389
257
|
|
|
390
|
-
|
|
391
|
-
* Gets the onAnimationLoop signal.
|
|
392
|
-
* @returns {Signal} The Signal object for the onAnimationLoop event.
|
|
393
|
-
*/
|
|
394
|
-
get onAnimationLoop() {
|
|
258
|
+
get onAnimationLoop(): Signal {
|
|
395
259
|
if (!this._onAnimationLoop) {
|
|
396
260
|
this._onAnimationLoop = new Signal();
|
|
397
261
|
}
|
|
398
262
|
return this._onAnimationLoop;
|
|
399
263
|
}
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Dispatches the onAnimationLoop event.
|
|
403
|
-
* @param {...any} args - Arguments to pass to the signal.
|
|
404
|
-
*/
|
|
405
|
-
onAnimationLoop$dispatch(...args) {
|
|
264
|
+
onAnimationLoop$dispatch(...args: unknown[]): void {
|
|
406
265
|
if (this._onAnimationLoop) {
|
|
407
266
|
this._onAnimationLoop.dispatch(...args);
|
|
408
267
|
}
|
|
409
268
|
}
|
|
410
|
-
}
|
|
269
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { BitmapText } from '../display/bitmap_text.js';
|
|
3
2
|
import { Button } from '../display/button.js';
|
|
4
3
|
import { Graphics } from '../display/graphics.js';
|
|
@@ -7,12 +6,12 @@ import { Image } from '../display/image.js';
|
|
|
7
6
|
import { Text } from '../display/text.js';
|
|
8
7
|
|
|
9
8
|
export class GameObjectFactory {
|
|
10
|
-
game;
|
|
9
|
+
game!: any;
|
|
11
10
|
/**
|
|
12
11
|
* Creates a new GameObjectFactory instance.
|
|
13
12
|
* @param {import('./game.js').Game} game - The game instance this factory belongs to.
|
|
14
13
|
*/
|
|
15
|
-
constructor(game) {
|
|
14
|
+
constructor(game: import('./game.js').Game) {
|
|
16
15
|
this.game = game;
|
|
17
16
|
}
|
|
18
17
|
|
|
@@ -25,7 +24,7 @@ game;
|
|
|
25
24
|
* @param {Group} group - The parent group for the image.
|
|
26
25
|
* @returns {Image} The created Image object.
|
|
27
26
|
*/
|
|
28
|
-
image(x, y, key, frame, group = null) {
|
|
27
|
+
image(x: number, y: number, key: string, frame: any, group: Group = null) {
|
|
29
28
|
if (!group) {
|
|
30
29
|
group = this.game.world;
|
|
31
30
|
}
|
|
@@ -39,7 +38,7 @@ game;
|
|
|
39
38
|
* @param {boolean} addToStage - Whether to add the group to the stage.
|
|
40
39
|
* @returns {Group} The created Group object.
|
|
41
40
|
*/
|
|
42
|
-
group(parent = null, name = null, addToStage = false) {
|
|
41
|
+
group(parent: Group | null = null, name: string | null = null, addToStage: boolean = false) {
|
|
43
42
|
return new Group(this.game, parent, name, addToStage);
|
|
44
43
|
}
|
|
45
44
|
|
|
@@ -52,7 +51,7 @@ game;
|
|
|
52
51
|
* @param {Group | null} group - The parent group for the text.
|
|
53
52
|
* @returns {Text} The created Text object.
|
|
54
53
|
*/
|
|
55
|
-
text(x, y, text, style, group = null) {
|
|
54
|
+
text(x: number, y: number, text: any, style: any, group: Group | null = null) {
|
|
56
55
|
const parent = group || this.game.world;
|
|
57
56
|
return parent.add(new Text(this.game, x, y, text, style));
|
|
58
57
|
}
|
|
@@ -72,16 +71,16 @@ game;
|
|
|
72
71
|
* @returns {Button} The created Button object.
|
|
73
72
|
*/
|
|
74
73
|
button(
|
|
75
|
-
x,
|
|
76
|
-
y,
|
|
77
|
-
key,
|
|
78
|
-
callback = null,
|
|
79
|
-
callbackContext = null,
|
|
80
|
-
overFrame = null,
|
|
81
|
-
outFrame = null,
|
|
82
|
-
downFrame = null,
|
|
83
|
-
upFrame = null,
|
|
84
|
-
group = null
|
|
74
|
+
x: number,
|
|
75
|
+
y: number,
|
|
76
|
+
key: string,
|
|
77
|
+
callback: Function | null = null,
|
|
78
|
+
callbackContext: any | null = null,
|
|
79
|
+
overFrame: string | null = null,
|
|
80
|
+
outFrame: string | null = null,
|
|
81
|
+
downFrame: string | null = null,
|
|
82
|
+
upFrame: string | null = null,
|
|
83
|
+
group: Group | null = null
|
|
85
84
|
) {
|
|
86
85
|
const parent = group || this.game.world;
|
|
87
86
|
return parent.add(
|
|
@@ -96,7 +95,7 @@ game;
|
|
|
96
95
|
* @param {Group | null} group - The parent group for the graphics object.
|
|
97
96
|
* @returns {Graphics} The created Graphics object.
|
|
98
97
|
*/
|
|
99
|
-
graphics(x = 0, y = 0, group = null) {
|
|
98
|
+
graphics(x: number = 0, y: number = 0, group: Group | null = null) {
|
|
100
99
|
const parent = group || this.game.world;
|
|
101
100
|
return parent.add(new Graphics(this.game, x, y));
|
|
102
101
|
}
|
|
@@ -112,7 +111,15 @@ game;
|
|
|
112
111
|
* @param {string} align - The alignment of the text.
|
|
113
112
|
* @returns {BitmapText} The created BitmapText object.
|
|
114
113
|
*/
|
|
115
|
-
bitmapText(
|
|
114
|
+
bitmapText(
|
|
115
|
+
x: number,
|
|
116
|
+
y: number,
|
|
117
|
+
font: string,
|
|
118
|
+
text: string,
|
|
119
|
+
size: number,
|
|
120
|
+
group: Group | null = null,
|
|
121
|
+
align: string = 'left'
|
|
122
|
+
) {
|
|
116
123
|
const parent = group || this.game.world;
|
|
117
124
|
return parent.add(new BitmapText(this.game, x, y, font, text, size, align));
|
|
118
125
|
}
|
package/src/phaser/core/frame.ts
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
import { Rectangle } from '../geom/rectangle.js';
|
|
3
2
|
import { distance } from '../util/math.js';
|
|
4
3
|
import { cloneFrame } from './frame_util.js';
|
|
5
4
|
|
|
6
5
|
export class Frame {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
index!: number;
|
|
7
|
+
x!: number;
|
|
8
|
+
y!: number;
|
|
9
|
+
width!: number;
|
|
10
|
+
height!: number;
|
|
11
|
+
name!: string;
|
|
12
|
+
centerX!: number;
|
|
13
|
+
centerY!: number;
|
|
14
|
+
distance!: number;
|
|
15
|
+
rotated!: boolean;
|
|
16
|
+
rotationDirection!: 'cw' | 'ccw';
|
|
17
|
+
trimmed!: boolean;
|
|
18
|
+
sourceSizeW!: number;
|
|
19
|
+
sourceSizeH!: number;
|
|
20
|
+
spriteSourceSizeX!: number;
|
|
21
|
+
spriteSourceSizeY!: number;
|
|
22
|
+
spriteSourceSizeW!: number;
|
|
23
|
+
spriteSourceSizeH!: number;
|
|
24
|
+
right!: number;
|
|
25
|
+
bottom!: number;
|
|
26
|
+
|
|
27
|
+
constructor(index: number, x: number, y: number, width: number, height: number, name?: string) {
|
|
17
28
|
this.initialize(index, x, y, width, height, name);
|
|
18
29
|
}
|
|
19
30
|
|
|
20
|
-
|
|
21
|
-
* Initializes this frame with the specified properties.
|
|
22
|
-
* @param {number} index - The index of this frame in the animation.
|
|
23
|
-
* @param {number} x - The x coordinate of this frame's position in the texture.
|
|
24
|
-
* @param {number} y - The y coordinate of this frame's position in the texture.
|
|
25
|
-
* @param {number} width - The width of this frame in pixels.
|
|
26
|
-
* @param {number} height - The height of this frame in pixels.
|
|
27
|
-
* @param {string} name - The name of this frame.
|
|
28
|
-
*/
|
|
29
|
-
initialize(index, x, y, width, height, name) {
|
|
31
|
+
initialize(index: number, x: number, y: number, width: number, height: number, name?: string): void {
|
|
30
32
|
this.index = index;
|
|
31
33
|
this.x = x;
|
|
32
34
|
this.y = y;
|
|
33
35
|
this.width = width;
|
|
34
36
|
this.height = height;
|
|
35
|
-
this.name = name;
|
|
37
|
+
this.name = name as string;
|
|
36
38
|
this.centerX = Math.floor(width / 2);
|
|
37
39
|
this.centerY = Math.floor(height / 2);
|
|
38
40
|
this.distance = distance(0, 0, width, height);
|
|
@@ -49,12 +51,7 @@ export class Frame {
|
|
|
49
51
|
this.bottom = this.y + this.height;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
|
|
53
|
-
* Resizes this frame to the specified dimensions.
|
|
54
|
-
* @param {number} width - The new width of this frame in pixels.
|
|
55
|
-
* @param {number} height - The new height of this frame in pixels.
|
|
56
|
-
*/
|
|
57
|
-
resize(width, height) {
|
|
54
|
+
resize(width: number, height: number): void {
|
|
58
55
|
this.width = width;
|
|
59
56
|
this.height = height;
|
|
60
57
|
this.centerX = Math.floor(width / 2);
|
|
@@ -66,17 +63,15 @@ export class Frame {
|
|
|
66
63
|
this.bottom = this.y + height;
|
|
67
64
|
}
|
|
68
65
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
*/
|
|
79
|
-
setTrim(trimmed, actualWidth, actualHeight, destX, destY, destWidth, destHeight) {
|
|
66
|
+
setTrim(
|
|
67
|
+
trimmed: boolean,
|
|
68
|
+
actualWidth: number,
|
|
69
|
+
actualHeight: number,
|
|
70
|
+
destX: number,
|
|
71
|
+
destY: number,
|
|
72
|
+
destWidth: number,
|
|
73
|
+
destHeight: number
|
|
74
|
+
): void {
|
|
80
75
|
this.trimmed = trimmed;
|
|
81
76
|
if (trimmed) {
|
|
82
77
|
this.sourceSizeW = actualWidth;
|
|
@@ -90,22 +85,13 @@ export class Frame {
|
|
|
90
85
|
}
|
|
91
86
|
}
|
|
92
87
|
|
|
93
|
-
|
|
94
|
-
* Creates a clone of this frame.
|
|
95
|
-
* @returns {Frame} A new Frame instance with the same properties.
|
|
96
|
-
*/
|
|
97
|
-
clone() {
|
|
88
|
+
clone(): Frame {
|
|
98
89
|
return cloneFrame(this);
|
|
99
90
|
}
|
|
100
91
|
|
|
101
|
-
|
|
102
|
-
* Gets the rectangle bounds of this frame.
|
|
103
|
-
* @param {Rectangle} output - The rectangle to use for the result (optional).
|
|
104
|
-
* @returns {Rectangle} A Rectangle object representing this frame's bounds.
|
|
105
|
-
*/
|
|
106
|
-
getRect(output = null) {
|
|
92
|
+
getRect(output: Rectangle | null = null): Rectangle {
|
|
107
93
|
const result = output || new Rectangle();
|
|
108
94
|
result.setTo(this.x, this.y, this.width, this.height);
|
|
109
95
|
return result;
|
|
110
96
|
}
|
|
111
|
-
}
|
|
97
|
+
}
|