angry-pixel 1.2.3 → 1.2.4

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 (142) hide show
  1. package/README.md +170 -168
  2. package/api-docs/.nojekyll +1 -0
  3. package/api-docs/assets/highlight.css +92 -0
  4. package/api-docs/assets/main.js +59 -0
  5. package/api-docs/assets/navigation.js +1 -0
  6. package/api-docs/assets/search.js +1 -0
  7. package/api-docs/assets/style.css +1383 -0
  8. package/api-docs/classes/Animator.html +128 -0
  9. package/api-docs/classes/AudioPlayer.html +131 -0
  10. package/api-docs/classes/BallCollider.html +132 -0
  11. package/api-docs/classes/BoxCollider.html +136 -0
  12. package/api-docs/classes/Button.html +125 -0
  13. package/api-docs/classes/Camera.html +114 -0
  14. package/api-docs/classes/Component.html +106 -0
  15. package/api-docs/classes/EdgeCollider.html +134 -0
  16. package/api-docs/classes/Game.html +24 -0
  17. package/api-docs/classes/GameCamera.html +163 -0
  18. package/api-docs/classes/GameObject.html +149 -0
  19. package/api-docs/classes/GamepadController.html +11 -0
  20. package/api-docs/classes/GamepadData.html +81 -0
  21. package/api-docs/classes/KeyboardController.html +43 -0
  22. package/api-docs/classes/MaskRenderer.html +119 -0
  23. package/api-docs/classes/MouseController.html +14 -0
  24. package/api-docs/classes/PhysicsComponent.html +107 -0
  25. package/api-docs/classes/PolygonCollider.html +134 -0
  26. package/api-docs/classes/PreRenderComponent.html +107 -0
  27. package/api-docs/classes/Rectangle.html +30 -0
  28. package/api-docs/classes/RigidBody.html +123 -0
  29. package/api-docs/classes/Rotation.html +5 -0
  30. package/api-docs/classes/Scene.html +73 -0
  31. package/api-docs/classes/SpacePointer.html +147 -0
  32. package/api-docs/classes/Sprite.html +20 -0
  33. package/api-docs/classes/SpriteRenderer.html +134 -0
  34. package/api-docs/classes/TextRenderer.html +138 -0
  35. package/api-docs/classes/TiledTilemapRenderer.html +127 -0
  36. package/api-docs/classes/TilemapCollider.html +124 -0
  37. package/api-docs/classes/TilemapRenderer.html +126 -0
  38. package/api-docs/classes/TouchController.html +8 -0
  39. package/api-docs/classes/Transform.html +124 -0
  40. package/api-docs/classes/Vector2.html +65 -0
  41. package/api-docs/classes/VideoRenderer.html +145 -0
  42. package/api-docs/enums/BroadPhaseMethods.html +3 -0
  43. package/api-docs/enums/ButtonType.html +3 -0
  44. package/api-docs/enums/CollisionMethods.html +3 -0
  45. package/api-docs/enums/RigidBodyType.html +4 -0
  46. package/api-docs/enums/TextOrientation.html +5 -0
  47. package/api-docs/enums/TilemapOrientation.html +5 -0
  48. package/api-docs/functions/between.html +5 -0
  49. package/api-docs/functions/clamp.html +5 -0
  50. package/api-docs/functions/fixedRound.html +4 -0
  51. package/api-docs/functions/randomFloat.html +4 -0
  52. package/api-docs/functions/randomInt.html +4 -0
  53. package/api-docs/functions/range.html +5 -0
  54. package/api-docs/index.html +37 -0
  55. package/api-docs/interfaces/AnimationConfig.html +10 -0
  56. package/api-docs/interfaces/AnimatorOptions.html +6 -0
  57. package/api-docs/interfaces/AudioPlayerOptions.html +8 -0
  58. package/api-docs/interfaces/BallColliderOptions.html +16 -0
  59. package/api-docs/interfaces/BoxColliderOptions.html +20 -0
  60. package/api-docs/interfaces/ButtonOptions.html +16 -0
  61. package/api-docs/interfaces/ColliderComponent.html +14 -0
  62. package/api-docs/interfaces/CollisionData.html +10 -0
  63. package/api-docs/interfaces/EdgeColliderOptions.html +18 -0
  64. package/api-docs/interfaces/GameConfig.html +28 -0
  65. package/api-docs/interfaces/IAssetManager.html +40 -0
  66. package/api-docs/interfaces/ICollider.html +11 -0
  67. package/api-docs/interfaces/ICollision.html +4 -0
  68. package/api-docs/interfaces/ICollisionResolution.html +4 -0
  69. package/api-docs/interfaces/IDomManager.html +6 -0
  70. package/api-docs/interfaces/IGameObjectManager.html +49 -0
  71. package/api-docs/interfaces/IInputManager.html +12 -0
  72. package/api-docs/interfaces/IPhysicsManager.html +8 -0
  73. package/api-docs/interfaces/IRenderManager.html +7 -0
  74. package/api-docs/interfaces/ISceneManager.html +18 -0
  75. package/api-docs/interfaces/ITimeManager.html +16 -0
  76. package/api-docs/interfaces/MaskRendererOptions.html +18 -0
  77. package/api-docs/interfaces/PolygonColliderOptions.html +18 -0
  78. package/api-docs/interfaces/RigidBodyOptions.html +17 -0
  79. package/api-docs/interfaces/Slice.html +5 -0
  80. package/api-docs/interfaces/SpriteConfig.html +10 -0
  81. package/api-docs/interfaces/SpriteRendererOptions.html +32 -0
  82. package/api-docs/interfaces/TextRendererOptions.html +38 -0
  83. package/api-docs/interfaces/TiledChunk.html +7 -0
  84. package/api-docs/interfaces/TiledLayer.html +17 -0
  85. package/api-docs/interfaces/TiledTilemap.html +9 -0
  86. package/api-docs/interfaces/TiledTilemapRendererOptions.html +18 -0
  87. package/api-docs/interfaces/TilemapColliderOptions.html +12 -0
  88. package/api-docs/interfaces/TilemapRendererOptions.html +22 -0
  89. package/api-docs/interfaces/Tileset.html +13 -0
  90. package/api-docs/interfaces/TouchInteraction.html +6 -0
  91. package/api-docs/interfaces/VideoRendererOptions.html +34 -0
  92. package/api-docs/modules.html +85 -0
  93. package/api-docs/types/CollisionMatrix.html +1 -0
  94. package/lib/component/Animator.d.ts +114 -8
  95. package/lib/component/AudioPlayer.d.ts +44 -6
  96. package/lib/component/Button.d.ts +82 -7
  97. package/lib/component/Camera.d.ts +27 -0
  98. package/lib/component/RigidBody.d.ts +75 -0
  99. package/lib/component/Sprite.d.ts +31 -3
  100. package/lib/component/Transform.d.ts +35 -0
  101. package/lib/component/collider/BallCollider.d.ts +48 -0
  102. package/lib/component/collider/BoxCollider.d.ts +57 -0
  103. package/lib/component/collider/Collider.d.ts +47 -1
  104. package/lib/component/collider/EdgeCollider.d.ts +52 -0
  105. package/lib/component/collider/PolygonCollider.d.ts +53 -0
  106. package/lib/component/collider/TilemapCollider.d.ts +41 -0
  107. package/lib/component/rendering/MaskRenderer.d.ts +56 -0
  108. package/lib/component/rendering/Sprite.d.ts +61 -0
  109. package/lib/component/rendering/SpriteRenderer.d.ts +92 -2
  110. package/lib/component/rendering/TextRenderer.d.ts +103 -4
  111. package/lib/component/rendering/TiledTilemapRenderer.d.ts +110 -3
  112. package/lib/component/rendering/TilemapRenderer.d.ts +120 -5
  113. package/lib/component/rendering/VideoRenderer.d.ts +91 -1
  114. package/lib/core/Component.d.ts +118 -0
  115. package/lib/core/Game.d.ts +47 -2
  116. package/lib/core/GameActor.d.ts +20 -4
  117. package/lib/core/GameConfig.d.ts +45 -2
  118. package/lib/core/GameObject.d.ts +63 -0
  119. package/lib/core/Scene.d.ts +32 -0
  120. package/lib/core/ioc/Config.d.ts +2 -1
  121. package/lib/core/managers/AssetManager.d.ts +68 -6
  122. package/lib/core/managers/DomManager.d.ts +11 -0
  123. package/lib/core/managers/GameObjectManager.d.ts +81 -0
  124. package/lib/core/managers/HeadlessIterationManager.d.ts +1 -0
  125. package/lib/core/managers/IterationManager.d.ts +4 -0
  126. package/lib/core/managers/SceneManager.d.ts +29 -1
  127. package/lib/core/managers/TimeManager.d.ts +37 -2
  128. package/lib/gameObject/GameCamera.d.ts +22 -0
  129. package/lib/gameObject/SpacePointer.d.ts +7 -0
  130. package/lib/index.cjs.js +1 -1
  131. package/lib/index.d.ts +1 -1
  132. package/lib/index.esm.js +1 -1
  133. package/lib/index.js +1 -1
  134. package/lib/input/GamepadController.d.ts +176 -2
  135. package/lib/input/InputManager.d.ts +18 -0
  136. package/lib/input/KeyboardController.d.ts +70 -1
  137. package/lib/input/MouseController.d.ts +35 -0
  138. package/lib/input/TouchController.d.ts +36 -4
  139. package/lib/utils/Container.d.ts +1 -0
  140. package/lib/utils/Exception.d.ts +1 -0
  141. package/package.json +9 -5
  142. package/typedoc.json +13 -0
@@ -1,14 +1,56 @@
1
1
  import { Vector2 } from "angry-pixel-math";
2
+ /**
3
+ * Manages the connected gamepads
4
+ * @public
5
+ * @category Input
6
+ * @example
7
+ * ```js
8
+ * // get all connected gamepads
9
+ * const gamepads = this.inputManager.gamepad.getGamepads();
10
+ *
11
+ * // get the first connected gamepad
12
+ * const gamepad = this.inputManager.gamepad.getGamepad(0);
13
+ * ```
14
+ */
2
15
  export declare class GamepadController {
3
16
  private readonly gamepads;
17
+ /** @private */
4
18
  constructor();
5
- getGamepad(index: number): GamepadData;
19
+ /**
20
+ * Returns a gamepad by its numerical index, or null if it does not exist.
21
+ * @param index The gamepad index to find
22
+ * @returns The found gamepad or NULL
23
+ */
24
+ getGamepad(index: number): GamepadData | null;
25
+ /**
26
+ * Retruns all connected gamepads.
27
+ * @returns An array of gamepads
28
+ */
29
+ getGamepads(): GamepadData[];
6
30
  private eventHandler;
7
31
  private gamepadConnected;
8
32
  private gamepadDisconected;
33
+ /** @private */
9
34
  update(): void;
10
- private getGamepads;
35
+ private getGamepadsFromBrowser;
11
36
  }
37
+ /**
38
+ * Represents a connected gamepad and has the information of all its buttons and axes.
39
+ * @public
40
+ * @category Input
41
+ * @example
42
+ * ```js
43
+ * const gamepad = this.inputManager.gamepad.getGamepad(0);
44
+ *
45
+ * if (gamepad.dpadAxes.x > 1) {
46
+ * // if the depad x-axis is pressed to the right, do some action
47
+ * }
48
+ *
49
+ * if (gamepad.rightFace) {
50
+ * // if the right face button is pressed, do some action
51
+ * }
52
+ * ```
53
+ */
12
54
  export declare class GamepadData {
13
55
  private _gamepad;
14
56
  private readonly buttons;
@@ -17,35 +59,167 @@ export declare class GamepadData {
17
59
  private readonly _leftStickAxes;
18
60
  private readonly _rightStickAxes;
19
61
  private _vibrating;
62
+ /** @private */
20
63
  updateFromGamepad(gamepad: Gamepad): void;
64
+ /**
65
+ * The gamepad id
66
+ * @readonly
67
+ */
21
68
  get id(): string;
69
+ /**
70
+ * TRUE if the gamepad is connected
71
+ * @readonly
72
+ */
22
73
  get connected(): boolean;
74
+ /**
75
+ * Checks if a button is being pressed.
76
+ * @param index the button index
77
+ * @returns TRUE if the button is pressed, FALSE instead
78
+ * @see [Gamepad: buttons property](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/buttons)
79
+ */
23
80
  getButtonPressed(index: number): boolean;
81
+ /**
82
+ * Returns the value of an axis by its index
83
+ * @param index The axis index:
84
+ * - 0: Left stick horizontal axix
85
+ * - 1: Left stick vertical axix
86
+ * - 2: Right stick horizontal axix
87
+ * - 3: Right stick vertical axix
88
+ * @returns The axis value
89
+ * @see [Gamepad: axes property](https://developer.mozilla.org/en-US/docs/Web/API/Gamepad/axes)
90
+ */
24
91
  getAxis(index: number): number;
92
+ /**
93
+ * The values of the d-pad axes represented as a xy vector
94
+ * @readonly
95
+ */
25
96
  get dpadAxes(): Vector2;
97
+ /**
98
+ * The values of the left stick axes represented as a xy vector
99
+ * @readonly
100
+ */
26
101
  get leftStickAxes(): Vector2;
102
+ /**
103
+ * The values of the right stick axes represented as a xy vector
104
+ * @readonly
105
+ */
27
106
  get rightStickAxes(): Vector2;
107
+ /**
108
+ * TRUE if d-pad up is pressed
109
+ * @readonly
110
+ */
28
111
  get dpadUp(): boolean;
112
+ /**
113
+ * TRUE if d-pad down is pressed
114
+ * @readonly
115
+ */
29
116
  get dpadDown(): boolean;
117
+ /**
118
+ * TRUE if d-pad left is pressed
119
+ * @readonly
120
+ */
30
121
  get dpadLeft(): boolean;
122
+ /**
123
+ * TRUE if d-pad right is pressed
124
+ * @readonly
125
+ */
31
126
  get dpadRight(): boolean;
127
+ /**
128
+ * TRUE if bottom face button is pressed (Dual Shock: X. Xbox: A. Nintendo: B)
129
+ * @readonly
130
+ */
32
131
  get bottomFace(): boolean;
132
+ /**
133
+ * TRUE if right face button is pressed (Dual Shock: Square. Xbox: X. Nintendo: Y)
134
+ * @readonly
135
+ */
33
136
  get rightFace(): boolean;
137
+ /**
138
+ * TRUE if left face button is pressed (Dual Shock: Circle. Xbox: B. Nintendo: A)
139
+ * @readonly
140
+ */
34
141
  get leftFace(): boolean;
142
+ /**
143
+ * TRUE if top face button is pressed (Dual Shock: Triangle. Xbox: Y. Nintendo: X)
144
+ * @readonly
145
+ */
35
146
  get topFace(): boolean;
147
+ /**
148
+ * TRUE if left shoulder button is pressed (Dual Shock: L1. Xbox: LB. Nintendo: L)
149
+ * @readonly
150
+ */
36
151
  get leftShoulder(): boolean;
152
+ /**
153
+ * TRUE if right shoulder button is pressed (Dual Shock: R1. Xbox: RB. Nintendo: R)
154
+ * @readonly
155
+ */
37
156
  get rightShoulder(): boolean;
157
+ /**
158
+ * TRUE if left trigger button is pressed (Dual Shock: L2. Xbox: LT. Nintendo: ZL)
159
+ * @readonly
160
+ */
38
161
  get leftTrigger(): boolean;
162
+ /**
163
+ * TRUE if right trigger button is pressed (Dual Shock: R2. Xbox: RT. Nintendo: ZR)
164
+ * @readonly
165
+ */
39
166
  get rightTrigger(): boolean;
167
+ /**
168
+ * TRUE if back button is pressed (a.k.a. select button)
169
+ * @readonly
170
+ */
40
171
  get back(): boolean;
172
+ /**
173
+ * TRUE if start button is pressed (a.k.a. options button)
174
+ * @readonly
175
+ */
41
176
  get start(): boolean;
177
+ /**
178
+ * TRUE if left stick button is pressed
179
+ * @readonly
180
+ */
42
181
  get leftStickButton(): boolean;
182
+ /**
183
+ * TRUE if right stick button is pressed
184
+ * @readonly
185
+ */
43
186
  get rightStickButton(): boolean;
187
+ /**
188
+ * Left stick horizontal axes value
189
+ * @readonly
190
+ */
44
191
  get leftStickHorizontal(): number;
192
+ /**
193
+ * Left stick vertical axes value
194
+ * @readonly
195
+ */
45
196
  get leftStickVertical(): number;
197
+ /**
198
+ * Right stick horizontal axes value
199
+ * @readonly
200
+ */
46
201
  get rightStickHorizontal(): number;
202
+ /**
203
+ * Right stick vertical axes value
204
+ * @readonly
205
+ */
47
206
  get rightStickVertical(): number;
207
+ /**
208
+ * TRUE if any button is pressed
209
+ * @readonly
210
+ */
48
211
  get anyButtonPressed(): boolean;
212
+ /**
213
+ * TRUE if the vibration is on
214
+ * @readonly
215
+ */
49
216
  get vibrating(): boolean;
217
+ /**
218
+ * Turns on the gamepad vibration
219
+ * @param duration The duration of the effect in milliseconds
220
+ * @param weakMagnitude Rumble intensity of the high-frequency (weak) rumble motors, normalized to the range between 0.0 and 1.0
221
+ * @param strongMagnitude Rumble intensity of the low-frequency (strong) rumble motors, normalized to the range between 0.0 and 1.0
222
+ * @param startDelay The delay in milliseconds before the effect is started
223
+ */
50
224
  vibrate(duration?: number, weakMagnitude?: number, strongMagnitude?: number, startDelay?: number): void;
51
225
  }
@@ -2,13 +2,31 @@ import { MouseController } from "./MouseController";
2
2
  import { KeyboardController } from "./KeyboardController";
3
3
  import { GamepadController } from "./GamepadController";
4
4
  import { TouchController } from "./TouchController";
5
+ /**
6
+ * Manages the input sources: Keyboard, Mouse, Gamepad, Touch.
7
+ * @public
8
+ * @category Managers
9
+ * @example
10
+ * ```js
11
+ * const mouseController = this.inputManager.mouse;
12
+ * const keyboardController = this.inputManager.keyboard;
13
+ * const gamepadController = this.inputManager.gamepad;
14
+ * const touchController = this.inputManager.touch;
15
+ * ```
16
+ */
5
17
  export interface IInputManager {
18
+ /** Manages mouse information. */
6
19
  mouse: MouseController;
20
+ /** Manages keyboard information. */
7
21
  keyboard: KeyboardController;
22
+ /** Manages gamepads information. */
8
23
  gamepad: GamepadController;
24
+ /** Manages toush information. */
9
25
  touch: TouchController;
26
+ /** @private */
10
27
  update(): void;
11
28
  }
29
+ /** @private */
12
30
  export declare class InputManager implements IInputManager {
13
31
  mouse: MouseController;
14
32
  keyboard: KeyboardController;
@@ -1,12 +1,81 @@
1
+ /**
2
+ * Manages keyboard interaction. It uses the **code** property of the **js keyboard event**.
3
+ * @see [KeyboardEvent: code property](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
4
+ * @public
5
+ * @category Input
6
+ * @example
7
+ * ```js
8
+ * const keyboard = this.inputManager.keyboard;
9
+ *
10
+ * if (keyboard.isPressed("ArrowRight")) {
11
+ * // if the right arrow key is pressed, do some action
12
+ * }
13
+ *
14
+ * if (keyboard.orPressed("Enter", "Space")) {
15
+ * // if the enter key or space key are pressed, do some action
16
+ * }
17
+ *
18
+ * if (keyboard.andPressed("ControlLeft", "KeyC")) {
19
+ * // if the left control key and the letter C key are pressed, do some action
20
+ * }
21
+ * ```
22
+ */
1
23
  export declare class KeyboardController {
2
- pressedKeys: string[];
24
+ /**
25
+ * The current pressed keys
26
+ * @readonly
27
+ */
28
+ readonly pressedKeys: string[];
3
29
  private keyMap;
30
+ /** @private */
4
31
  constructor(canvas: HTMLCanvasElement);
5
32
  private eventHandler;
33
+ /**
34
+ * Returns TRUE if the given key is being pressed.
35
+ * @see [KeyboardEvent: code property](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
36
+ * @param keyCode The code of the key to check
37
+ * @returns TRUE true for pressed, FALSE instead
38
+ */
6
39
  isPressed(keyCode: string): boolean;
40
+ /**
41
+ * Returns TRUE if one of the given keys is being pressed.
42
+ * @see [KeyboardEvent: code property](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
43
+ * @param keyCodes The codes of the keys to check
44
+ * @returns TRUE for pressed, FALSE instead
45
+ */
7
46
  orPressed(keyCodes: string[]): boolean;
47
+ /**
48
+ * Returns TRUE if all the given keys are being pressed.
49
+ * @see [KeyboardEvent: code property](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
50
+ * @param keyCodes The codes of the keys to check
51
+ * @returns TRUE for pressed, FALSE instead
52
+ */
8
53
  andPressed(keyCodes: string[]): boolean;
54
+ /**
55
+ * This method accepts two parameters that will be returned depending on whether the key is pressed or not.
56
+ * @see [KeyboardEvent: code property](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
57
+ * @param keyCode The code of the key to check
58
+ * @param returnTrue The value to return if the key is pressed
59
+ * @param returnFalse The value to return if the key is not pressed
60
+ * @returns The returnTrue for pressed or the returnFalse instead
61
+ */
9
62
  isPressedReturn<T>(keyCode: string, returnTrue: T, returnFalse: T): T;
63
+ /**
64
+ * This method accepts two parameters that will be returned depending on whether one of the given keys is being pressed.
65
+ * @see [KeyboardEvent: code property](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
66
+ * @param keyCodes The codes of the keys to check
67
+ * @param returnTrue The value to return if the key is pressed
68
+ * @param returnFalse The value to return if the key is not pressed
69
+ * @returns The returnTrue for pressed or the returnFalse instead
70
+ */
10
71
  orPressedReturn<T>(keyCodes: string[], returnTrue: T, returnFalse: T): T;
72
+ /**
73
+ * This method accepts two parameters that will be returned depending on whether all the given keys are being pressed.
74
+ * @see [KeyboardEvent: code property](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code)
75
+ * @param keyCodes The codes of the keys to check
76
+ * @param returnTrue The value to return if the key is pressed
77
+ * @param returnFalse The value to return if the key is not pressed
78
+ * @returns The returnTrue for pressed or the returnFalse instead
79
+ */
11
80
  andPressedReturn<T>(keyCodes: string[], returnTrue: T, returnFalse: T): T;
12
81
  }
@@ -1,4 +1,17 @@
1
1
  import { Vector2 } from "angry-pixel-math";
2
+ /**
3
+ * Manages mouse interaction
4
+ * @public
5
+ * @category Input
6
+ * @example
7
+ * ```js
8
+ * const mouse = this.inputManager.mouse;
9
+ *
10
+ * if (mouse.positionInViewport.y < 0 && mouse.leftButtonPressed()) {
11
+ * // if the mouse pointer is below the middle of the screen and left click, do something
12
+ * }
13
+ * ```
14
+ */
2
15
  export declare class MouseController {
3
16
  private _leftButtonPressed;
4
17
  private _scrollButtonPressed;
@@ -7,12 +20,34 @@ export declare class MouseController {
7
20
  private _hasMoved;
8
21
  private lastPositionInViewport;
9
22
  private canvas;
23
+ /** @private */
10
24
  constructor(canvas: HTMLCanvasElement);
25
+ /**
26
+ * TRUE if the left button is being pressed
27
+ * @readonly
28
+ */
11
29
  get leftButtonPressed(): boolean;
30
+ /**
31
+ * TRUE if the scroll button is being pressed
32
+ * @readonly
33
+ */
12
34
  get scrollButtonPressed(): boolean;
35
+ /**
36
+ * TRUE if the right button is beign pressed
37
+ * @readonly
38
+ */
13
39
  get rightButtonPressed(): boolean;
40
+ /**
41
+ * The position of the pointer in the screen view port
42
+ * @readonly
43
+ */
14
44
  get positionInViewport(): Vector2;
45
+ /**
46
+ * TRUE if the mouse moved during the last frame
47
+ * @readonly
48
+ */
15
49
  get hasMoved(): boolean;
50
+ /** @private */
16
51
  update(): void;
17
52
  private setup;
18
53
  private updateButtonDown;
@@ -1,13 +1,45 @@
1
1
  import { Vector2 } from "angry-pixel-math";
2
+ /**
3
+ * The information about one interaction with the screen
4
+ * @public
5
+ * @category Input
6
+ */
7
+ export interface TouchInteraction {
8
+ /** The interaction position on the screen */
9
+ positionInViewport: Vector2;
10
+ /** The area of the interaction represented as a radius of the ellipse */
11
+ radius: Vector2;
12
+ }
13
+ /**
14
+ * Manages the touch screen interaction.
15
+ * @public
16
+ * @category Input
17
+ * @example
18
+ * ```js
19
+ * const touch = this.inputController.touch;
20
+ *
21
+ * if (touch.touching) {
22
+ * const interaction = touch.interactions[0];
23
+ * }
24
+ *
25
+ * ```
26
+ */
2
27
  export declare class TouchController {
3
28
  private canvas;
4
29
  private _touching;
5
- private _positionInViewport;
6
- private _radius;
30
+ private _interactions;
31
+ /** @private */
7
32
  constructor(canvas: HTMLCanvasElement);
8
- get positionInViewport(): Vector2;
33
+ /**
34
+ * TRUE if there is an interaction with the screen
35
+ * @readonly
36
+ */
9
37
  get touching(): boolean;
10
- get radius(): Vector2;
38
+ /**
39
+ * The information about the interactions with the screen
40
+ * @readonly
41
+ */
42
+ get interactions(): TouchInteraction[];
11
43
  private eventHandler;
12
44
  private updatePosition;
13
45
  }
@@ -1,4 +1,5 @@
1
1
  type constructor = () => unknown;
2
+ /** @private */
2
3
  export declare class Container {
3
4
  private instances;
4
5
  private constructors;
@@ -1,4 +1,5 @@
1
1
  export declare const exceptionName = "AngryPixelException";
2
+ /** @private */
2
3
  export declare class Exception extends Error {
3
4
  constructor(message: string);
4
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angry-pixel",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "Lightweight 2D game engine made with TypeScript.",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -12,7 +12,8 @@
12
12
  "lint": "eslint . --ext .ts",
13
13
  "lint-and-fix": "eslint . --ext .ts --fix",
14
14
  "prettier-format": "prettier --write \"src/**/*.{ts,js,css,html}\"",
15
- "prettier-check": "prettier --check \"src/**/*.{ts,js,css,html}\""
15
+ "prettier-check": "prettier --check \"src/**/*.{ts,js,css,html}\"",
16
+ "docs": "typedoc"
16
17
  },
17
18
  "repository": {
18
19
  "type": "git",
@@ -38,14 +39,17 @@
38
39
  "devDependencies": {
39
40
  "@rollup/plugin-commonjs": "^19.0.0",
40
41
  "@rollup/plugin-node-resolve": "^13.0.0",
41
- "@typescript-eslint/eslint-plugin": "^5.50.0",
42
- "@typescript-eslint/parser": "^5.50.0",
43
- "eslint": "^8.45.0",
42
+ "@types/node": "^20.8.9",
43
+ "@typescript-eslint/eslint-plugin": "^6.10.0",
44
+ "@typescript-eslint/parser": "^6.10.0",
45
+ "eslint": "^8.53.0",
44
46
  "prettier": "^2.1.2",
45
47
  "rollup": "^2.49.0",
46
48
  "rollup-plugin-terser": "^7.0.2",
47
49
  "rollup-plugin-typescript2": "^0.35.0",
48
50
  "tslib": "^2.6.1",
51
+ "typedoc": "^0.25.3",
52
+ "typedoc-plugin-markdown": "^3.16.0",
49
53
  "typescript": "^5.1.6"
50
54
  },
51
55
  "dependencies": {
package/typedoc.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "name": "Angry Pixel Engine",
4
+ "entryPoints": ["./src/index.ts"],
5
+ "out": "api-docs",
6
+ "excludePrivate": true,
7
+ "excludeInternal": true,
8
+ "navigation": {
9
+ "includeCategories": true
10
+ },
11
+ "categoryOrder": ["Core", "Components", "Managers", "Game Objects", "Input"],
12
+ "defaultCategory": "Core"
13
+ }