@rpgjs/client 5.0.0-alpha.3 → 5.0.0-alpha.30

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 (275) hide show
  1. package/dist/Game/AnimationManager.d.ts +8 -0
  2. package/dist/{index19.js → Game/AnimationManager.js} +4 -3
  3. package/dist/Game/AnimationManager.js.map +1 -0
  4. package/dist/{index30.js → Game/Event.js} +2 -2
  5. package/dist/Game/Event.js.map +1 -0
  6. package/dist/Game/Map.d.ts +8 -1
  7. package/dist/Game/Map.js +54 -0
  8. package/dist/Game/Map.js.map +1 -0
  9. package/dist/Game/Object.d.ts +129 -0
  10. package/dist/Game/Object.js +218 -0
  11. package/dist/Game/Object.js.map +1 -0
  12. package/dist/{index29.js → Game/Player.js} +2 -2
  13. package/dist/Game/Player.js.map +1 -0
  14. package/dist/Gui/Gui.d.ts +177 -5
  15. package/dist/Gui/Gui.js +478 -0
  16. package/dist/Gui/Gui.js.map +1 -0
  17. package/dist/Gui/NotificationManager.d.ts +23 -0
  18. package/dist/Gui/NotificationManager.js +51 -0
  19. package/dist/Gui/NotificationManager.js.map +1 -0
  20. package/dist/Resource.d.ts +97 -0
  21. package/dist/Resource.js +114 -0
  22. package/dist/Resource.js.map +1 -0
  23. package/dist/RpgClient.d.ts +259 -59
  24. package/dist/RpgClientEngine.d.ts +632 -9
  25. package/dist/RpgClientEngine.js +1262 -0
  26. package/dist/RpgClientEngine.js.map +1 -0
  27. package/dist/Sound.d.ts +199 -0
  28. package/dist/Sound.js +97 -0
  29. package/dist/Sound.js.map +1 -0
  30. package/dist/components/animations/animation.ce.js +21 -0
  31. package/dist/components/animations/animation.ce.js.map +1 -0
  32. package/dist/{index23.js → components/animations/hit.ce.js} +3 -3
  33. package/dist/components/animations/hit.ce.js.map +1 -0
  34. package/dist/components/animations/index.d.ts +4 -0
  35. package/dist/components/animations/index.js +10 -0
  36. package/dist/components/animations/index.js.map +1 -0
  37. package/dist/components/character.ce.js +316 -0
  38. package/dist/components/character.ce.js.map +1 -0
  39. package/dist/components/dynamics/parse-value.d.ts +1 -0
  40. package/dist/components/dynamics/parse-value.js +54 -0
  41. package/dist/components/dynamics/parse-value.js.map +1 -0
  42. package/dist/components/dynamics/text.ce.js +141 -0
  43. package/dist/components/dynamics/text.ce.js.map +1 -0
  44. package/dist/components/gui/box.ce.js +27 -0
  45. package/dist/components/gui/box.ce.js.map +1 -0
  46. package/dist/components/gui/dialogbox/index.ce.js +152 -0
  47. package/dist/components/gui/dialogbox/index.ce.js.map +1 -0
  48. package/dist/components/gui/gameover.ce.js +141 -0
  49. package/dist/components/gui/gameover.ce.js.map +1 -0
  50. package/dist/components/gui/hud/hud.ce.js +35 -0
  51. package/dist/components/gui/hud/hud.ce.js.map +1 -0
  52. package/dist/components/gui/index.d.ts +15 -3
  53. package/dist/components/gui/menu/equip-menu.ce.js +349 -0
  54. package/dist/components/gui/menu/equip-menu.ce.js.map +1 -0
  55. package/dist/components/gui/menu/exit-menu.ce.js +35 -0
  56. package/dist/components/gui/menu/exit-menu.ce.js.map +1 -0
  57. package/dist/components/gui/menu/items-menu.ce.js +229 -0
  58. package/dist/components/gui/menu/items-menu.ce.js.map +1 -0
  59. package/dist/components/gui/menu/main-menu.ce.js +205 -0
  60. package/dist/components/gui/menu/main-menu.ce.js.map +1 -0
  61. package/dist/components/gui/menu/options-menu.ce.js +28 -0
  62. package/dist/components/gui/menu/options-menu.ce.js.map +1 -0
  63. package/dist/components/gui/menu/skills-menu.ce.js +53 -0
  64. package/dist/components/gui/menu/skills-menu.ce.js.map +1 -0
  65. package/dist/components/gui/mobile/index.d.ts +8 -0
  66. package/dist/components/gui/mobile/index.js +24 -0
  67. package/dist/components/gui/mobile/index.js.map +1 -0
  68. package/dist/components/gui/mobile/mobile.ce.js +17 -0
  69. package/dist/components/gui/mobile/mobile.ce.js.map +1 -0
  70. package/dist/components/gui/notification/notification.ce.js +38 -0
  71. package/dist/components/gui/notification/notification.ce.js.map +1 -0
  72. package/dist/components/gui/save-load.ce.js +242 -0
  73. package/dist/components/gui/save-load.ce.js.map +1 -0
  74. package/dist/components/gui/shop/shop.ce.js +322 -0
  75. package/dist/components/gui/shop/shop.ce.js.map +1 -0
  76. package/dist/components/gui/title-screen.ce.js +148 -0
  77. package/dist/components/gui/title-screen.ce.js.map +1 -0
  78. package/dist/components/index.d.ts +3 -1
  79. package/dist/components/prebuilt/hp-bar.ce.js +106 -0
  80. package/dist/components/prebuilt/hp-bar.ce.js.map +1 -0
  81. package/dist/components/prebuilt/index.d.ts +19 -0
  82. package/dist/components/prebuilt/light-halo.ce.js +76 -0
  83. package/dist/components/prebuilt/light-halo.ce.js.map +1 -0
  84. package/dist/components/scenes/canvas.ce.js +44 -0
  85. package/dist/components/scenes/canvas.ce.js.map +1 -0
  86. package/dist/components/scenes/draw-map.ce.js +34 -0
  87. package/dist/components/scenes/draw-map.ce.js.map +1 -0
  88. package/dist/{index13.js → components/scenes/event-layer.ce.js} +7 -6
  89. package/dist/components/scenes/event-layer.ce.js.map +1 -0
  90. package/dist/{index6.js → core/inject.js} +2 -2
  91. package/dist/core/inject.js.map +1 -0
  92. package/dist/core/setup.js +16 -0
  93. package/dist/core/setup.js.map +1 -0
  94. package/dist/index.d.ts +15 -1
  95. package/dist/index.js +40 -12
  96. package/dist/index.js.map +1 -1
  97. package/dist/module.d.ts +43 -4
  98. package/dist/module.js +175 -0
  99. package/dist/module.js.map +1 -0
  100. package/dist/node_modules/.pnpm/@signe_di@2.8.2/node_modules/@signe/di/dist/index.js +366 -0
  101. package/dist/node_modules/.pnpm/@signe_di@2.8.2/node_modules/@signe/di/dist/index.js.map +1 -0
  102. package/dist/{index27.js → node_modules/.pnpm/@signe_reactive@2.8.2/node_modules/@signe/reactive/dist/index.js} +229 -11
  103. package/dist/node_modules/.pnpm/@signe_reactive@2.8.2/node_modules/@signe/reactive/dist/index.js.map +1 -0
  104. package/dist/{index20.js → node_modules/.pnpm/@signe_room@2.8.2/node_modules/@signe/room/dist/index.js} +308 -40
  105. package/dist/node_modules/.pnpm/@signe_room@2.8.2/node_modules/@signe/room/dist/index.js.map +1 -0
  106. package/dist/{index26.js → node_modules/.pnpm/@signe_sync@2.8.2/node_modules/@signe/sync/dist/chunk-7QVYU63E.js} +1 -1
  107. package/dist/node_modules/.pnpm/@signe_sync@2.8.2/node_modules/@signe/sync/dist/chunk-7QVYU63E.js.map +1 -0
  108. package/dist/{index21.js → node_modules/.pnpm/@signe_sync@2.8.2/node_modules/@signe/sync/dist/client/index.js} +5 -5
  109. package/dist/node_modules/.pnpm/@signe_sync@2.8.2/node_modules/@signe/sync/dist/client/index.js.map +1 -0
  110. package/dist/{index17.js → node_modules/.pnpm/@signe_sync@2.8.2/node_modules/@signe/sync/dist/index.js} +89 -12
  111. package/dist/node_modules/.pnpm/@signe_sync@2.8.2/node_modules/@signe/sync/dist/index.js.map +1 -0
  112. package/dist/{index33.js → node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js} +1 -1
  113. package/dist/node_modules/.pnpm/dset@3.1.4/node_modules/dset/dist/index.js.map +1 -0
  114. package/dist/{index31.js → node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js} +2 -2
  115. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-HAC622V3.js.map +1 -0
  116. package/dist/{index32.js → node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js} +1 -1
  117. package/dist/node_modules/.pnpm/partysocket@1.1.3/node_modules/partysocket/dist/chunk-S74YV6PU.js.map +1 -0
  118. package/dist/{index34.js → node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js} +1 -1
  119. package/dist/node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.js.map +1 -0
  120. package/dist/presets/animation.d.ts +31 -0
  121. package/dist/presets/animation.js +27 -0
  122. package/dist/presets/animation.js.map +1 -0
  123. package/dist/presets/faceset.d.ts +30 -0
  124. package/dist/presets/faceset.js +24 -0
  125. package/dist/presets/faceset.js.map +1 -0
  126. package/dist/presets/icon.d.ts +20 -0
  127. package/dist/presets/icon.js +15 -0
  128. package/dist/presets/icon.js.map +1 -0
  129. package/dist/presets/index.d.ts +123 -0
  130. package/dist/presets/index.js +16 -0
  131. package/dist/presets/index.js.map +1 -0
  132. package/dist/presets/lpc.d.ts +89 -0
  133. package/dist/presets/lpc.js +95 -0
  134. package/dist/presets/lpc.js.map +1 -0
  135. package/dist/{index25.js → presets/rmspritesheet.js} +1 -1
  136. package/dist/presets/rmspritesheet.js.map +1 -0
  137. package/dist/{index16.js → services/AbstractSocket.js} +1 -1
  138. package/dist/services/AbstractSocket.js.map +1 -0
  139. package/dist/services/keyboardControls.d.ts +15 -0
  140. package/dist/services/keyboardControls.js +21 -0
  141. package/dist/services/keyboardControls.js.map +1 -0
  142. package/dist/services/loadMap.d.ts +123 -2
  143. package/dist/{index7.js → services/loadMap.js} +12 -4
  144. package/dist/services/loadMap.js.map +1 -0
  145. package/dist/services/mmorpg.d.ts +16 -4
  146. package/dist/services/mmorpg.js +84 -0
  147. package/dist/services/mmorpg.js.map +1 -0
  148. package/dist/services/save.d.ts +19 -0
  149. package/dist/services/save.js +69 -0
  150. package/dist/services/save.js.map +1 -0
  151. package/dist/services/standalone.d.ts +65 -3
  152. package/dist/services/standalone.js +170 -0
  153. package/dist/services/standalone.js.map +1 -0
  154. package/dist/utils/getEntityProp.d.ts +39 -0
  155. package/dist/utils/getEntityProp.js +54 -0
  156. package/dist/utils/getEntityProp.js.map +1 -0
  157. package/package.json +24 -18
  158. package/src/Game/{EffectManager.ts → AnimationManager.ts} +3 -2
  159. package/src/Game/Map.ts +37 -2
  160. package/src/Game/Object.ts +296 -11
  161. package/src/Gui/Gui.ts +506 -18
  162. package/src/Gui/NotificationManager.ts +69 -0
  163. package/src/Resource.ts +150 -0
  164. package/src/RpgClient.ts +264 -58
  165. package/src/RpgClientEngine.ts +1421 -44
  166. package/src/Sound.ts +253 -0
  167. package/src/components/{effects → animations}/animation.ce +3 -6
  168. package/src/components/{effects → animations}/index.ts +1 -1
  169. package/src/components/character.ce +406 -40
  170. package/src/components/dynamics/parse-value.ts +80 -0
  171. package/src/components/dynamics/text.ce +183 -0
  172. package/src/components/gui/box.ce +17 -0
  173. package/src/components/gui/dialogbox/index.ce +204 -187
  174. package/src/components/gui/gameover.ce +158 -0
  175. package/src/components/gui/hud/hud.ce +56 -0
  176. package/src/components/gui/index.ts +30 -4
  177. package/src/components/gui/menu/equip-menu.ce +410 -0
  178. package/src/components/gui/menu/exit-menu.ce +41 -0
  179. package/src/components/gui/menu/items-menu.ce +317 -0
  180. package/src/components/gui/menu/main-menu.ce +291 -0
  181. package/src/components/gui/menu/options-menu.ce +35 -0
  182. package/src/components/gui/menu/skills-menu.ce +83 -0
  183. package/src/components/gui/mobile/index.ts +24 -0
  184. package/src/components/gui/mobile/mobile.ce +80 -0
  185. package/src/components/gui/notification/notification.ce +51 -0
  186. package/src/components/gui/save-load.ce +208 -0
  187. package/src/components/gui/shop/shop.ce +493 -0
  188. package/src/components/gui/title-screen.ce +163 -0
  189. package/src/components/index.ts +5 -1
  190. package/src/components/prebuilt/hp-bar.ce +255 -0
  191. package/src/components/prebuilt/index.ts +24 -0
  192. package/src/components/prebuilt/light-halo.ce +148 -0
  193. package/src/components/scenes/canvas.ce +19 -14
  194. package/src/components/scenes/draw-map.ce +21 -29
  195. package/src/components/scenes/event-layer.ce +10 -3
  196. package/src/components/scenes/transition.ce +60 -0
  197. package/src/core/setup.ts +2 -0
  198. package/src/index.ts +16 -2
  199. package/src/module.ts +145 -9
  200. package/src/presets/animation.ts +46 -0
  201. package/src/presets/faceset.ts +60 -0
  202. package/src/presets/icon.ts +17 -0
  203. package/src/presets/index.ts +9 -1
  204. package/src/presets/lpc.ts +108 -0
  205. package/src/services/keyboardControls.ts +20 -0
  206. package/src/services/loadMap.ts +132 -3
  207. package/src/services/mmorpg.ts +39 -5
  208. package/src/services/save.ts +103 -0
  209. package/src/services/standalone.ts +107 -15
  210. package/src/utils/getEntityProp.ts +87 -0
  211. package/tsconfig.json +1 -1
  212. package/vite.config.ts +5 -3
  213. package/CHANGELOG.md +0 -9
  214. package/dist/Game/EffectManager.d.ts +0 -5
  215. package/dist/components/effects/index.d.ts +0 -4
  216. package/dist/index10.js +0 -8
  217. package/dist/index10.js.map +0 -1
  218. package/dist/index11.js +0 -10
  219. package/dist/index11.js.map +0 -1
  220. package/dist/index12.js +0 -8
  221. package/dist/index12.js.map +0 -1
  222. package/dist/index13.js.map +0 -1
  223. package/dist/index14.js +0 -50
  224. package/dist/index14.js.map +0 -1
  225. package/dist/index15.js +0 -191
  226. package/dist/index15.js.map +0 -1
  227. package/dist/index16.js.map +0 -1
  228. package/dist/index17.js.map +0 -1
  229. package/dist/index18.js +0 -31
  230. package/dist/index18.js.map +0 -1
  231. package/dist/index19.js.map +0 -1
  232. package/dist/index2.js +0 -112
  233. package/dist/index2.js.map +0 -1
  234. package/dist/index20.js.map +0 -1
  235. package/dist/index21.js.map +0 -1
  236. package/dist/index22.js +0 -109
  237. package/dist/index22.js.map +0 -1
  238. package/dist/index23.js.map +0 -1
  239. package/dist/index24.js +0 -21
  240. package/dist/index24.js.map +0 -1
  241. package/dist/index25.js.map +0 -1
  242. package/dist/index26.js.map +0 -1
  243. package/dist/index27.js.map +0 -1
  244. package/dist/index28.js +0 -25
  245. package/dist/index28.js.map +0 -1
  246. package/dist/index29.js.map +0 -1
  247. package/dist/index3.js +0 -87
  248. package/dist/index3.js.map +0 -1
  249. package/dist/index30.js.map +0 -1
  250. package/dist/index31.js.map +0 -1
  251. package/dist/index32.js.map +0 -1
  252. package/dist/index33.js.map +0 -1
  253. package/dist/index34.js.map +0 -1
  254. package/dist/index35.js +0 -91
  255. package/dist/index35.js.map +0 -1
  256. package/dist/index36.js +0 -61
  257. package/dist/index36.js.map +0 -1
  258. package/dist/index37.js +0 -20
  259. package/dist/index37.js.map +0 -1
  260. package/dist/index38.js +0 -20
  261. package/dist/index38.js.map +0 -1
  262. package/dist/index4.js +0 -54
  263. package/dist/index4.js.map +0 -1
  264. package/dist/index5.js +0 -15
  265. package/dist/index5.js.map +0 -1
  266. package/dist/index6.js.map +0 -1
  267. package/dist/index7.js.map +0 -1
  268. package/dist/index8.js +0 -90
  269. package/dist/index8.js.map +0 -1
  270. package/dist/index9.js +0 -76
  271. package/dist/index9.js.map +0 -1
  272. package/src/components/gui/dialogbox/itemMenu.ce +0 -23
  273. package/src/components/gui/dialogbox/selection.ce +0 -67
  274. package/src/components/scenes/element-map.ce +0 -23
  275. /package/src/components/{effects → animations}/hit.ce +0 -0
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Creates an animation spritesheet preset with automatic frame generation
3
+ *
4
+ * This function generates animation frames based on the provided width and height dimensions.
5
+ * It creates a sequence of frames that progresses through the spritesheet from left to right,
6
+ * top to bottom, with each frame having a 10ms time increment.
7
+ *
8
+ * @param {number} framesWidth - The number of frames horizontally in the spritesheet
9
+ * @param {number} framesHeight - The number of frames vertically in the spritesheet
10
+ * @returns {Object} Animation preset configuration object
11
+ *
12
+ * @example
13
+ * ```javascript
14
+ * // For a 4x4 spritesheet
15
+ * const preset = AnimationSpritesheetPreset(4, 4);
16
+ * // This will generate 16 frames with coordinates from (0,0) to (3,3)
17
+ * ```
18
+ */
19
+ export declare const AnimationSpritesheetPreset: (framesWidth: number, framesHeight: number) => {
20
+ framesWidth: number;
21
+ framesHeight: number;
22
+ textures: {
23
+ default: {
24
+ animations: () => {
25
+ time: number;
26
+ frameX: number;
27
+ frameY: number;
28
+ }[][];
29
+ };
30
+ };
31
+ };
@@ -0,0 +1,27 @@
1
+ const AnimationSpritesheetPreset = (framesWidth, framesHeight) => {
2
+ const animations = [];
3
+ for (let y = 0; y < framesHeight; y++) {
4
+ for (let x = 0; x < framesWidth; x++) {
5
+ const frameIndex = y * framesWidth + x;
6
+ animations.push({
7
+ time: frameIndex * 10,
8
+ frameX: x,
9
+ frameY: y
10
+ });
11
+ }
12
+ }
13
+ return {
14
+ framesWidth,
15
+ framesHeight,
16
+ textures: {
17
+ default: {
18
+ animations: () => [
19
+ animations
20
+ ]
21
+ }
22
+ }
23
+ };
24
+ };
25
+
26
+ export { AnimationSpritesheetPreset };
27
+ //# sourceMappingURL=animation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animation.js","sources":["../../src/presets/animation.ts"],"sourcesContent":["/**\n * Creates an animation spritesheet preset with automatic frame generation\n * \n * This function generates animation frames based on the provided width and height dimensions.\n * It creates a sequence of frames that progresses through the spritesheet from left to right,\n * top to bottom, with each frame having a 10ms time increment.\n * \n * @param {number} framesWidth - The number of frames horizontally in the spritesheet\n * @param {number} framesHeight - The number of frames vertically in the spritesheet\n * @returns {Object} Animation preset configuration object\n * \n * @example\n * ```javascript\n * // For a 4x4 spritesheet\n * const preset = AnimationSpritesheetPreset(4, 4);\n * // This will generate 16 frames with coordinates from (0,0) to (3,3)\n * ```\n */\nexport const AnimationSpritesheetPreset = (framesWidth: number, framesHeight: number) => {\n \n const animations: Array<{ time: number; frameX: number; frameY: number }> = [];\n\n for (let y = 0; y < framesHeight; y++) {\n for (let x = 0; x < framesWidth; x++) {\n const frameIndex = y * framesWidth + x;\n animations.push({ \n time: frameIndex * 10, \n frameX: x, \n frameY: y \n });\n }\n }\n \n return {\n framesWidth,\n framesHeight,\n textures: {\n default: {\n animations: () => [\n animations\n ],\n }\n }\n };\n};\n "],"names":[],"mappings":"AAkBO,MAAM,0BAAA,GAA6B,CAAC,WAAA,EAAqB,YAAA,KAAyB;AAErF,EAAA,MAAM,aAAsE,EAAC;AAE7E,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,YAAA,EAAc,CAAA,EAAA,EAAK;AACnC,IAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,WAAA,EAAa,CAAA,EAAA,EAAK;AAClC,MAAA,MAAM,UAAA,GAAa,IAAI,WAAA,GAAc,CAAA;AACrC,MAAA,UAAA,CAAW,IAAA,CAAK;AAAA,QACZ,MAAM,UAAA,GAAa,EAAA;AAAA,QACnB,MAAA,EAAQ,CAAA;AAAA,QACR,MAAA,EAAQ;AAAA,OACX,CAAA;AAAA,IACL;AAAA,EACJ;AAEA,EAAA,OAAO;AAAA,IACH,WAAA;AAAA,IACA,YAAA;AAAA,IACA,QAAA,EAAU;AAAA,MACN,OAAA,EAAS;AAAA,QACL,YAAY,MAAM;AAAA,UACd;AAAA;AACJ;AACJ;AACJ,GACJ;AACJ;;;;"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Creates a faceset preset for character expressions
3
+ *
4
+ * This preset allows you to define multiple facial expressions for a character,
5
+ * where each expression corresponds to a specific frame position (frameX, frameY)
6
+ * within a single faceset texture. Each expression is defined by its position
7
+ * in the faceset grid.
8
+ *
9
+ * @param options - Object containing the faceset configuration
10
+ * @param framesWidth - Number of frames horizontally in the faceset texture
11
+ * @param framesHeight - Number of frames vertically in the faceset texture
12
+ * @param expressions - Object mapping expression names to their frame positions as tuples [frameX, frameY]
13
+ * @returns Faceset configuration with animations for each expression
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const faceset = FacesetPreset({
18
+ * id: "facesetId",
19
+ * image: "faceset.png",
20
+ * width: 1024,
21
+ * height: 1024,
22
+ * }, 4, 2, {
23
+ * happy: [0, 0],
24
+ * sad: [1, 0],
25
+ * angry: [2, 0],
26
+ * surprised: [3, 0]
27
+ * });
28
+ * ```
29
+ */
30
+ export declare const FacesetPreset: (options: any, framesWidth: number, framesHeight: number, expressions: Record<string, [number, number]>) => any;
@@ -0,0 +1,24 @@
1
+ const FacesetPreset = (options, framesWidth, framesHeight, expressions) => {
2
+ const textures = {};
3
+ Object.keys(expressions).forEach((expressionName) => {
4
+ const [frameX, frameY] = expressions[expressionName];
5
+ textures[expressionName] = {
6
+ animations: () => [
7
+ [{
8
+ time: 0,
9
+ frameX,
10
+ frameY
11
+ }]
12
+ ]
13
+ };
14
+ });
15
+ return {
16
+ ...options,
17
+ framesWidth,
18
+ framesHeight,
19
+ textures
20
+ };
21
+ };
22
+
23
+ export { FacesetPreset };
24
+ //# sourceMappingURL=faceset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"faceset.js","sources":["../../src/presets/faceset.ts"],"sourcesContent":["/**\n * Creates a faceset preset for character expressions\n * \n * This preset allows you to define multiple facial expressions for a character,\n * where each expression corresponds to a specific frame position (frameX, frameY)\n * within a single faceset texture. Each expression is defined by its position\n * in the faceset grid.\n * \n * @param options - Object containing the faceset configuration\n * @param framesWidth - Number of frames horizontally in the faceset texture\n * @param framesHeight - Number of frames vertically in the faceset texture\n * @param expressions - Object mapping expression names to their frame positions as tuples [frameX, frameY]\n * @returns Faceset configuration with animations for each expression\n * \n * @example\n * ```typescript\n * const faceset = FacesetPreset({\n * id: \"facesetId\",\n * image: \"faceset.png\",\n * width: 1024,\n * height: 1024,\n * }, 4, 2, {\n * happy: [0, 0],\n * sad: [1, 0],\n * angry: [2, 0],\n * surprised: [3, 0]\n * });\n * ```\n */\nexport const FacesetPreset = (\n options: any,\n framesWidth: number, \n framesHeight: number,\n expressions: Record<string, [number, number]>,\n) => {\n \n const textures: Record<string, any> = {};\n \n // Create texture configuration for each expression\n Object.keys(expressions).forEach((expressionName) => {\n const [frameX, frameY] = expressions[expressionName];\n textures[expressionName] = {\n animations: () => [\n [{ \n time: 0, \n frameX: frameX, \n frameY: frameY \n }]\n ],\n };\n });\n \n return {\n ...options,\n framesWidth,\n framesHeight,\n textures\n };\n};\n "],"names":[],"mappings":"AA6BO,MAAM,aAAA,GAAgB,CACzB,OAAA,EACA,WAAA,EACA,cACA,WAAA,KACC;AAED,EAAA,MAAM,WAAgC,EAAC;AAGvC,EAAA,MAAA,CAAO,IAAA,CAAK,WAAW,CAAA,CAAE,OAAA,CAAQ,CAAC,cAAA,KAAmB;AACjD,IAAA,MAAM,CAAC,MAAA,EAAQ,MAAM,CAAA,GAAI,YAAY,cAAc,CAAA;AACnD,IAAA,QAAA,CAAS,cAAc,CAAA,GAAI;AAAA,MACvB,YAAY,MAAM;AAAA,QACd,CAAC;AAAA,UACG,IAAA,EAAM,CAAA;AAAA,UACN,MAAA;AAAA,UACA;AAAA,SACH;AAAA;AACL,KACJ;AAAA,EACJ,CAAC,CAAA;AAED,EAAA,OAAO;AAAA,IACH,GAAG,OAAA;AAAA,IACH,WAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,GACJ;AACJ;;;;"}
@@ -0,0 +1,20 @@
1
+ export declare const IconPreset: (options: {
2
+ image: string;
3
+ framesWidth: number;
4
+ framesHeight: number;
5
+ id: string;
6
+ }) => {
7
+ image: string;
8
+ framesWidth: number;
9
+ framesHeight: number;
10
+ id: string;
11
+ textures: {
12
+ default: {
13
+ animations: () => {
14
+ time: number;
15
+ frameX: number;
16
+ frameY: number;
17
+ }[][];
18
+ };
19
+ };
20
+ };
@@ -0,0 +1,15 @@
1
+ const IconPreset = (options) => {
2
+ return {
3
+ textures: {
4
+ default: {
5
+ animations: () => [
6
+ [{ time: 0, frameX: 0, frameY: 0 }]
7
+ ]
8
+ }
9
+ },
10
+ ...options
11
+ };
12
+ };
13
+
14
+ export { IconPreset };
15
+ //# sourceMappingURL=icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon.js","sources":["../../src/presets/icon.ts"],"sourcesContent":["export const IconPreset = (options: {\n image: string;\n framesWidth: number;\n framesHeight: number;\n id: string;\n}) => {\n return {\n textures: {\n default: {\n animations: () => [\n [{ time: 0, frameX: 0, frameY: 0 }]\n ]\n }\n },\n ...options\n }\n}"],"names":[],"mappings":"AAAO,MAAM,UAAA,GAAa,CAAC,OAAA,KAKrB;AACF,EAAA,OAAO;AAAA,IACH,QAAA,EAAU;AAAA,MACN,OAAA,EAAS;AAAA,QACL,YAAY,MAAM;AAAA,UACd,CAAC,EAAE,IAAA,EAAM,CAAA,EAAG,QAAQ,CAAA,EAAG,MAAA,EAAQ,GAAG;AAAA;AACtC;AACJ,KACJ;AAAA,IACA,GAAG;AAAA,GACP;AACJ;;;;"}
@@ -19,4 +19,127 @@ export declare const Presets: {
19
19
  framesHeight: number;
20
20
  framesWidth: number;
21
21
  };
22
+ LPCSpritesheetPreset: (options: {
23
+ id: string;
24
+ imageSource: string;
25
+ width: number;
26
+ height: number;
27
+ ratio?: number;
28
+ }) => {
29
+ id: string;
30
+ image: string;
31
+ width: number;
32
+ height: number;
33
+ opacity: number;
34
+ rectWidth: number;
35
+ rectHeight: number;
36
+ framesWidth: number;
37
+ framesHeight: number;
38
+ spriteRealSize: {
39
+ width: number;
40
+ height: number;
41
+ };
42
+ textures: {
43
+ attack3?: {
44
+ offset: {
45
+ x: number;
46
+ y: number;
47
+ };
48
+ rectWidth: number;
49
+ rectHeight: number;
50
+ framesWidth: number;
51
+ framesHeight: number;
52
+ animations: ({ direction }: {
53
+ direction: any;
54
+ }) => any[];
55
+ } | undefined;
56
+ stand: {
57
+ offset: {
58
+ x: number;
59
+ y: number;
60
+ };
61
+ animations: ({ direction }: {
62
+ direction: any;
63
+ }) => {
64
+ time: number;
65
+ frameX: number;
66
+ frameY: number;
67
+ }[][];
68
+ };
69
+ walk: {
70
+ offset: {
71
+ x: number;
72
+ y: number;
73
+ };
74
+ framesWidth: number;
75
+ framesHeight: number;
76
+ animations: ({ direction }: {
77
+ direction: any;
78
+ }) => any[];
79
+ };
80
+ attack: {
81
+ offset: {
82
+ x: number;
83
+ y: number;
84
+ };
85
+ framesWidth: number;
86
+ framesHeight: number;
87
+ animations: ({ direction }: {
88
+ direction: any;
89
+ }) => any[];
90
+ };
91
+ skill: {
92
+ framesWidth: number;
93
+ framesHeight: number;
94
+ animations: ({ direction }: {
95
+ direction: any;
96
+ }) => any[];
97
+ };
98
+ attack2: {
99
+ offset: {
100
+ x: number;
101
+ y: number;
102
+ };
103
+ framesWidth: number;
104
+ framesHeight: number;
105
+ animations: ({ direction }: {
106
+ direction: any;
107
+ }) => any[];
108
+ };
109
+ };
110
+ };
111
+ AnimationSpritesheetPreset: (framesWidth: number, framesHeight: number) => {
112
+ framesWidth: number;
113
+ framesHeight: number;
114
+ textures: {
115
+ default: {
116
+ animations: () => {
117
+ time: number;
118
+ frameX: number;
119
+ frameY: number;
120
+ }[][];
121
+ };
122
+ };
123
+ };
124
+ FacesetPreset: (options: any, framesWidth: number, framesHeight: number, expressions: Record<string, [number, number]>) => any;
125
+ IconPreset: (options: {
126
+ image: string;
127
+ framesWidth: number;
128
+ framesHeight: number;
129
+ id: string;
130
+ }) => {
131
+ image: string;
132
+ framesWidth: number;
133
+ framesHeight: number;
134
+ id: string;
135
+ textures: {
136
+ default: {
137
+ animations: () => {
138
+ time: number;
139
+ frameX: number;
140
+ frameY: number;
141
+ }[][];
142
+ };
143
+ };
144
+ };
22
145
  };
@@ -0,0 +1,16 @@
1
+ import { AnimationSpritesheetPreset } from './animation.js';
2
+ import { LPCSpritesheetPreset } from './lpc.js';
3
+ import { RMSpritesheet } from './rmspritesheet.js';
4
+ import { FacesetPreset } from './faceset.js';
5
+ import { IconPreset } from './icon.js';
6
+
7
+ const Presets = {
8
+ RMSpritesheet,
9
+ LPCSpritesheetPreset,
10
+ AnimationSpritesheetPreset,
11
+ FacesetPreset,
12
+ IconPreset
13
+ };
14
+
15
+ export { Presets };
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/presets/index.ts"],"sourcesContent":["import { AnimationSpritesheetPreset } from \"./animation\";\nimport { LPCSpritesheetPreset } from \"./lpc\";\nimport { RMSpritesheet } from \"./rmspritesheet\";\nimport { FacesetPreset } from \"./faceset\";\nimport { IconPreset } from \"./icon\";\n\nexport const Presets = {\n RMSpritesheet,\n LPCSpritesheetPreset,\n AnimationSpritesheetPreset,\n FacesetPreset,\n IconPreset\n}"],"names":[],"mappings":";;;;;;AAMO,MAAM,OAAA,GAAU;AAAA,EACnB,aAAA;AAAA,EACA,oBAAA;AAAA,EACA,0BAAA;AAAA,EACA,aAAA;AAAA,EACA;AACJ;;;;"}
@@ -0,0 +1,89 @@
1
+ export declare const LPCSpritesheetPreset: (options: {
2
+ id: string;
3
+ imageSource: string;
4
+ width: number;
5
+ height: number;
6
+ ratio?: number;
7
+ }) => {
8
+ id: string;
9
+ image: string;
10
+ width: number;
11
+ height: number;
12
+ opacity: number;
13
+ rectWidth: number;
14
+ rectHeight: number;
15
+ framesWidth: number;
16
+ framesHeight: number;
17
+ spriteRealSize: {
18
+ width: number;
19
+ height: number;
20
+ };
21
+ textures: {
22
+ attack3?: {
23
+ offset: {
24
+ x: number;
25
+ y: number;
26
+ };
27
+ rectWidth: number;
28
+ rectHeight: number;
29
+ framesWidth: number;
30
+ framesHeight: number;
31
+ animations: ({ direction }: {
32
+ direction: any;
33
+ }) => any[];
34
+ } | undefined;
35
+ stand: {
36
+ offset: {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ animations: ({ direction }: {
41
+ direction: any;
42
+ }) => {
43
+ time: number;
44
+ frameX: number;
45
+ frameY: number;
46
+ }[][];
47
+ };
48
+ walk: {
49
+ offset: {
50
+ x: number;
51
+ y: number;
52
+ };
53
+ framesWidth: number;
54
+ framesHeight: number;
55
+ animations: ({ direction }: {
56
+ direction: any;
57
+ }) => any[];
58
+ };
59
+ attack: {
60
+ offset: {
61
+ x: number;
62
+ y: number;
63
+ };
64
+ framesWidth: number;
65
+ framesHeight: number;
66
+ animations: ({ direction }: {
67
+ direction: any;
68
+ }) => any[];
69
+ };
70
+ skill: {
71
+ framesWidth: number;
72
+ framesHeight: number;
73
+ animations: ({ direction }: {
74
+ direction: any;
75
+ }) => any[];
76
+ };
77
+ attack2: {
78
+ offset: {
79
+ x: number;
80
+ y: number;
81
+ };
82
+ framesWidth: number;
83
+ framesHeight: number;
84
+ animations: ({ direction }: {
85
+ direction: any;
86
+ }) => any[];
87
+ };
88
+ };
89
+ };
@@ -0,0 +1,95 @@
1
+ import { Animation, Direction } from '@rpgjs/common';
2
+
3
+ const LPCSpritesheetPreset = (options) => {
4
+ const ratio = options.ratio ?? 1;
5
+ const frameY = (direction) => {
6
+ return {
7
+ [Direction.Down]: 2,
8
+ [Direction.Left]: 1,
9
+ [Direction.Right]: 3,
10
+ [Direction.Up]: 0
11
+ }[direction];
12
+ };
13
+ const stand = (direction) => [
14
+ { time: 0, frameX: 0, frameY: frameY(direction) }
15
+ ];
16
+ const anim = (direction, framesWidth, speed = 5) => {
17
+ const array = [];
18
+ for (let i = 0; i < framesWidth; i++) {
19
+ array.push({ time: i * speed, frameX: i, frameY: frameY(direction) });
20
+ }
21
+ return array;
22
+ };
23
+ return {
24
+ id: options.id,
25
+ image: options.imageSource,
26
+ width: options.width,
27
+ height: options.height,
28
+ opacity: 1,
29
+ rectWidth: 64 * ratio,
30
+ rectHeight: 64 * ratio,
31
+ framesWidth: 6,
32
+ framesHeight: 4,
33
+ spriteRealSize: {
34
+ width: 48 * ratio,
35
+ height: 52 * ratio
36
+ },
37
+ textures: {
38
+ [Animation.Stand]: {
39
+ offset: {
40
+ x: 0,
41
+ y: 512 * ratio
42
+ },
43
+ animations: ({ direction }) => [stand(direction)]
44
+ },
45
+ [Animation.Walk]: {
46
+ offset: {
47
+ x: 0,
48
+ y: 512 * ratio
49
+ },
50
+ framesWidth: 9,
51
+ framesHeight: 4,
52
+ animations: ({ direction }) => [anim(direction, 9)]
53
+ },
54
+ [Animation.Attack]: {
55
+ offset: {
56
+ x: 0,
57
+ y: 768 * ratio
58
+ },
59
+ framesWidth: 6,
60
+ framesHeight: 4,
61
+ animations: ({ direction }) => [anim(direction, 6, 3)]
62
+ },
63
+ [Animation.Skill]: {
64
+ framesWidth: 7,
65
+ framesHeight: 4,
66
+ animations: ({ direction }) => [anim(direction, 7, 3)]
67
+ },
68
+ attack2: {
69
+ offset: {
70
+ x: 0,
71
+ y: 256 * ratio
72
+ },
73
+ framesWidth: 7,
74
+ framesHeight: 8,
75
+ animations: ({ direction }) => [anim(direction, 7, 3)]
76
+ },
77
+ ...options.height > 3e3 ? {
78
+ attack3: {
79
+ offset: {
80
+ x: 0,
81
+ y: 5568 - 288 * 4
82
+ },
83
+ rectWidth: 288,
84
+ rectHeight: 288,
85
+ framesWidth: 6,
86
+ framesHeight: 4,
87
+ animations: ({ direction }) => [anim(direction, 6, 3)]
88
+ }
89
+ } : {}
90
+ }
91
+ };
92
+ };
93
+
94
+ export { LPCSpritesheetPreset };
95
+ //# sourceMappingURL=lpc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lpc.js","sources":["../../src/presets/lpc.ts"],"sourcesContent":["import { Animation, Direction } from \"@rpgjs/common\";\n\nexport const LPCSpritesheetPreset = (options: {\n id: string;\n imageSource: string;\n width: number;\n height: number;\n ratio?: number;\n }) => {\n const ratio = options.ratio ?? 1;\n\n const frameY = (direction: Direction) => {\n return {\n [Direction.Down]: 2,\n [Direction.Left]: 1,\n [Direction.Right]: 3,\n [Direction.Up]: 0,\n }[direction];\n };\n \n const stand = (direction: Direction) => [\n { time: 0, frameX: 0, frameY: frameY(direction) },\n ];\n const anim = (\n direction: Direction,\n framesWidth: number,\n speed: number = 5\n ) => {\n const array: any = [];\n for (let i = 0; i < framesWidth; i++) {\n array.push({ time: i * speed, frameX: i, frameY: frameY(direction) });\n }\n return array;\n };\n \n return {\n id: options.id,\n image: options.imageSource,\n width: options.width,\n height: options.height,\n opacity: 1,\n rectWidth: 64 * ratio,\n rectHeight: 64 * ratio,\n framesWidth: 6,\n framesHeight: 4,\n spriteRealSize: {\n width: 48 * ratio,\n height: 52 * ratio,\n },\n textures: {\n [Animation.Stand]: {\n offset: {\n x: 0,\n y: 512 * ratio,\n },\n animations: ({ direction }) => [stand(direction)],\n },\n [Animation.Walk]: {\n offset: {\n x: 0,\n y: 512 * ratio,\n },\n framesWidth: 9,\n framesHeight: 4,\n animations: ({ direction }) => [anim(direction, 9)],\n },\n [Animation.Attack]: {\n offset: {\n x: 0,\n y: 768 * ratio,\n },\n framesWidth: 6,\n framesHeight: 4,\n animations: ({ direction }) => [anim(direction, 6, 3)],\n },\n [Animation.Skill]: {\n framesWidth: 7,\n framesHeight: 4,\n animations: ({ direction }) => [anim(direction, 7, 3)],\n },\n attack2: {\n offset: {\n x: 0,\n y: 256 * ratio,\n },\n framesWidth: 7,\n framesHeight: 8,\n animations: ({ direction }) => [anim(direction, 7, 3)],\n },\n ...(options.height > 3000\n ? {\n attack3: {\n offset: {\n x: 0,\n y: 5568 - 288 * 4,\n },\n rectWidth: 288,\n rectHeight: 288,\n framesWidth: 6,\n framesHeight: 4,\n animations: ({ direction }) => [anim(direction, 6, 3)],\n },\n }\n : {}),\n },\n };\n };\n "],"names":[],"mappings":";;AAEO,MAAM,oBAAA,GAAuB,CAAC,OAAA,KAM7B;AACJ,EAAA,MAAM,KAAA,GAAQ,QAAQ,KAAA,IAAS,CAAA;AAE/B,EAAA,MAAM,MAAA,GAAS,CAAC,SAAA,KAAyB;AACvC,IAAA,OAAO;AAAA,MACL,CAAC,SAAA,CAAU,IAAI,GAAG,CAAA;AAAA,MAClB,CAAC,SAAA,CAAU,IAAI,GAAG,CAAA;AAAA,MAClB,CAAC,SAAA,CAAU,KAAK,GAAG,CAAA;AAAA,MACnB,CAAC,SAAA,CAAU,EAAE,GAAG;AAAA,MAChB,SAAS,CAAA;AAAA,EACb,CAAA;AAEA,EAAA,MAAM,KAAA,GAAQ,CAAC,SAAA,KAAyB;AAAA,IACtC,EAAE,MAAM,CAAA,EAAG,MAAA,EAAQ,GAAG,MAAA,EAAQ,MAAA,CAAO,SAAS,CAAA;AAAE,GAClD;AACA,EAAA,MAAM,IAAA,GAAO,CACX,SAAA,EACA,WAAA,EACA,QAAgB,CAAA,KACb;AACH,IAAA,MAAM,QAAa,EAAC;AACpB,IAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,WAAA,EAAa,CAAA,EAAA,EAAK;AACpC,MAAA,KAAA,CAAM,IAAA,CAAK,EAAE,IAAA,EAAM,CAAA,GAAI,KAAA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Spritesheet };
41
- //# sourceMappingURL=index25.js.map
41
+ //# sourceMappingURL=rmspritesheet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rmspritesheet.js","sources":["../../src/presets/rmspritesheet.ts"],"sourcesContent":["import { Direction, Animation } from '@rpgjs/common'\n\nexport const RMSpritesheet = (framesWidth: number, framesHeight: number, frameStand: number = 1) => {\n\n if (framesWidth <= frameStand) {\n frameStand = framesWidth - 1\n }\n\n const frameY = direction => {\n const gap = Math.max(4 - framesHeight, 0)\n return {\n [Direction.Down]: 0,\n [Direction.Left]: Math.max(0, 1 - gap),\n [Direction.Right]: Math.max(0, 2 - gap),\n [Direction.Up]: Math.max(0, 3 - gap)\n }[direction]\n }\n\n const stand = (direction: number) => [{ time: 0, frameX: frameStand, frameY: frameY(direction) }]\n const walk = direction => {\n const array: any = []\n const durationFrame = 10\n for (let i = 0; i < framesWidth; i++) {\n array.push({ time: i * durationFrame, frameX: i, frameY: frameY(direction) })\n }\n array.push({ time: array[array.length - 1].time + durationFrame })\n return array\n }\n\n return {\n textures: {\n [Animation.Stand]: {\n animations: ({direction}) => [stand(direction)]\n },\n [Animation.Walk]: {\n animations: ({direction}) => [walk(direction)]\n }\n },\n framesHeight,\n framesWidth\n }\n}"],"names":[],"mappings":";;AAEO,MAAM,aAAA,GAAgB,CAAC,WAAA,EAAqB,YAAA,EAAsB,aAAqB,CAAA,KAAM;AAEhG,EAAA,IAAI,eAAe,UAAA,EAAY;AAC3B,IAAA,UAAA,GAAa,WAAA,GAAc,CAAA;AAAA,EAC/B;AAEA,EAAA,MAAM,SAAS,CAAA,SAAA,KAAa;AACxB,IAAA,MAAM,GAAA,GAAM,IAAA,CAAK,GAAA,CAAI,CAAA,GAAI,cAAc,CAAC,CAAA;AACxC,IAAA,OAAO;AAAA,MACH,CAAC,SAAA,CAAU,IAAI,GAAG,CAAA;AAAA,MAClB,CAAC,UAAU,IAAI,GAAG,KAAK,GAAA,CAAI,CAAA,EAAG,IAAI,GAAG,C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A;AAAA,GACJ;AACJ;;;;"}
@@ -6,4 +6,4 @@ class AbstractWebsocket {
6
6
  }
7
7
 
8
8
  export { AbstractWebsocket, WebSocketToken };
9
- //# sourceMappingURL=index16.js.map
9
+ //# sourceMappingURL=AbstractSocket.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AbstractSocket.js","sources":["../../src/services/AbstractSocket.ts"],"sourcesContent":["import { Context } from \"@signe/di\";\n\nexport const WebSocketToken = \"websocket\";\n\nexport abstract class AbstractWebsocket {\n constructor(protected context: Context) {}\n\n abstract connection(listeners?: (data: any) => void): Promise<void>;\n abstract emit(event: string, data: any): void;\n abstract on(event: string, callback: (data: any) => void): void;\n abstract off(event: string, callback: (data: any) => void): void;\n abstract updateProperties(params: { room: string, host?: string }): void;\n abstract reconnect(listeners?: (data: any) => void): void;\n}\n"],"names":[],"mappings":"AAEO,MAAM,cAAA,GAAiB;AAEvB,MAAe,iBAAA,CAAkB;AAAA,EACtC,YAAsB,OAAA,EAAkB;AAAlB,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA,EAAmB;AAQ3C;;;;"}
@@ -0,0 +1,15 @@
1
+ export declare enum Control {
2
+ Action = "action",
3
+ Attack = "attack",
4
+ Defense = "defense",
5
+ Skill = "skill",
6
+ Back = "back",
7
+ Up = 1,
8
+ Down = 3,
9
+ Right = 2,
10
+ Left = 4
11
+ }
12
+ export declare function provideKeyboardControls(): {
13
+ provide: string;
14
+ useValue: null;
15
+ };
@@ -0,0 +1,21 @@
1
+ var Control = /* @__PURE__ */ ((Control2) => {
2
+ Control2["Action"] = "action";
3
+ Control2["Attack"] = "attack";
4
+ Control2["Defense"] = "defense";
5
+ Control2["Skill"] = "skill";
6
+ Control2["Back"] = "back";
7
+ Control2[Control2["Up"] = 1] = "Up";
8
+ Control2[Control2["Down"] = 3] = "Down";
9
+ Control2[Control2["Right"] = 2] = "Right";
10
+ Control2[Control2["Left"] = 4] = "Left";
11
+ return Control2;
12
+ })(Control || {});
13
+ function provideKeyboardControls() {
14
+ return {
15
+ provide: "KeyboardControls",
16
+ useValue: null
17
+ };
18
+ }
19
+
20
+ export { Control, provideKeyboardControls };
21
+ //# sourceMappingURL=keyboardControls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyboardControls.js","sources":["../../src/services/keyboardControls.ts"],"sourcesContent":["import { KeyboardControls } from \"canvasengine\";\n\nexport enum Control {\n Action = 'action',\n Attack = 'attack',\n Defense = 'defense',\n Skill = 'skill',\n Back = 'back',\n Up = 1,\n Down = 3,\n Right = 2,\n Left = 4\n}\n\nexport function provideKeyboardControls() {\n return {\n provide: 'KeyboardControls',\n useValue: null,\n };\n}"],"names":["Control"],"mappings":"AAEO,IAAK,OAAA,qBAAAA,QAAAA,KAAL;AACL,EAAAA,SAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,SAAA,QAAA,CAAA,GAAS,QAAA;AACT,EAAAA,SAAA,SAAA,CAAA,GAAU,SAAA;AACV,EAAAA,SAAA,OAAA,CAAA,GAAQ,OAAA;AACR,EAAAA,SAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,QAAK,CAAA,CAAA,GAAL,IAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,UAAO,CAAA,CAAA,GAAP,MAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,WAAQ,CAAA,CAAA,GAAR,OAAA;AACA,EAAAA,QAAAA,CAAAA,QAAAA,CAAA,UAAO,CAAA,CAAA,GAAP,MAAA;AATU,EAAA,OAAAA,QAAAA;AAAA,CAAA,EAAA,OAAA,IAAA,EAAA;AAYL,SAAS,uBAAA,GAA0B;AACxC,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,kBAAA;AAAA,IACT,QAAA,EAAU;AAAA,GACZ;AACF;;;;"}