react-simple-game-engine 0.1.63 → 0.1.66

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 (73) hide show
  1. package/lib/classes/animations/animation.d.ts.map +1 -0
  2. package/lib/classes/animations/animation.js +35 -0
  3. package/lib/classes/animations/avatar.animation.d.ts.map +1 -0
  4. package/lib/classes/animations/avatar.animation.js +45 -0
  5. package/lib/classes/animations/color.animation.d.ts.map +1 -0
  6. package/lib/classes/animations/color.animation.js +33 -0
  7. package/lib/classes/camera.d.ts.map +1 -0
  8. package/lib/classes/camera.js +34 -0
  9. package/lib/classes/entities/circle.entity.d.ts.map +1 -0
  10. package/lib/classes/entities/circle.entity.js +55 -0
  11. package/lib/classes/entities/entity-sult.d.ts.map +1 -0
  12. package/lib/classes/entities/entity-sult.js +108 -0
  13. package/lib/classes/entities/entity.d.ts.map +1 -0
  14. package/lib/classes/entities/entity.js +180 -0
  15. package/lib/classes/entities/rect.entity.d.ts.map +1 -0
  16. package/lib/classes/entities/rect.entity.js +56 -0
  17. package/lib/classes/logic-component.d.ts.map +1 -0
  18. package/lib/classes/logic-component.js +77 -0
  19. package/lib/classes/p5.d.ts.map +1 -0
  20. package/lib/classes/p5.js +58 -0
  21. package/lib/classes/particle-system.d.ts.map +1 -0
  22. package/lib/classes/particle-system.js +98 -0
  23. package/lib/classes/particle.d.ts.map +1 -0
  24. package/lib/classes/particle.js +117 -0
  25. package/lib/classes/prefab.d.ts.map +1 -0
  26. package/lib/classes/prefab.js +24 -0
  27. package/lib/classes/saver.d.ts.map +1 -0
  28. package/lib/classes/saver.js +33 -0
  29. package/lib/classes/scene-management.d.ts.map +1 -0
  30. package/lib/classes/scene-management.js +58 -0
  31. package/lib/classes/scene.d.ts +2 -2
  32. package/lib/classes/scene.d.ts.map +1 -0
  33. package/lib/classes/scene.js +433 -0
  34. package/lib/classes/sound-watcher.d.ts.map +1 -0
  35. package/lib/classes/sound-watcher.js +33 -0
  36. package/lib/classes/sound.d.ts.map +1 -0
  37. package/lib/classes/sound.js +119 -0
  38. package/lib/classes/sprites/avatar.sprite.d.ts.map +1 -0
  39. package/lib/classes/sprites/avatar.sprite.js +89 -0
  40. package/lib/classes/sprites/color.sprite.d.ts.map +1 -0
  41. package/lib/classes/sprites/color.sprite.js +40 -0
  42. package/lib/classes/sprites/sprite.d.ts.map +1 -0
  43. package/lib/classes/sprites/sprite.js +70 -0
  44. package/lib/classes/watcher.d.ts.map +1 -0
  45. package/lib/classes/watcher.js +44 -0
  46. package/lib/classes/world-management.d.ts.map +1 -0
  47. package/lib/classes/world-management.js +160 -0
  48. package/lib/decorators/scene-tag.decor.d.ts.map +1 -0
  49. package/lib/decorators/scene-tag.decor.js +5 -0
  50. package/lib/decorators/scene-ui.decor.d.ts.map +1 -0
  51. package/lib/decorators/scene-ui.decor.js +5 -0
  52. package/lib/decorators/sound-from.decor.d.ts.map +1 -0
  53. package/lib/decorators/sound-from.decor.js +20 -0
  54. package/lib/decorators/sprite-from.decor.d.ts.map +1 -0
  55. package/lib/decorators/sprite-from.decor.js +13 -0
  56. package/lib/export-enums.d.ts.map +1 -0
  57. package/lib/export-enums.js +5 -0
  58. package/lib/export-interfaces.d.ts.map +1 -0
  59. package/lib/export-interfaces.js +1 -0
  60. package/lib/export-types.d.ts.map +1 -0
  61. package/lib/export-types.js +1 -0
  62. package/lib/index.d.ts.map +1 -0
  63. package/lib/ui-components/SceneRunner.d.ts.map +1 -0
  64. package/lib/ui-components/SceneRunner.js +43 -0
  65. package/lib/ui-components/ScenesProcess.d.ts.map +1 -0
  66. package/lib/ui-components/ScenesProcess.js +46 -0
  67. package/lib/ui-components/Sketch.d.ts.map +1 -0
  68. package/lib/ui-components/Sketch.js +33 -0
  69. package/lib/utilities.d.ts.map +1 -0
  70. package/lib/utilities.js +2 -0
  71. package/lib/utils.d.ts.map +1 -0
  72. package/lib/utils.js +97 -0
  73. package/package.json +5 -9
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./classes/watcher";
2
+ export * from "./classes/sound-watcher";
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAiBxC,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAInE;AAED,wBAAsB,gBAAgB,CACpC,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,SAAS,GACf,OAAO,CAAC,KAAK,CAAC,CAWhB;AAED,wBAAsB,IAAI,CAAC,KAAK,CAAC,EAAE,MAAM,oBAQxC;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,QAO5B"}
package/lib/utils.js ADDED
@@ -0,0 +1,97 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (_) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import OutofScopeP5 from "p5";
38
+ import { Sound } from "./classes/sound";
39
+ var outofScopeP5;
40
+ document.addEventListener("DOMContentLoaded", function () {
41
+ var noop = document.createElement("div");
42
+ noop.style.position = "absolute";
43
+ noop.style.zIndex = "-1";
44
+ noop.style.top = "-100%";
45
+ noop.style.left = "-100%";
46
+ document.body.appendChild(noop);
47
+ setTimeout(function () {
48
+ outofScopeP5 = new OutofScopeP5(function (skt) { }, noop);
49
+ }, 0);
50
+ });
51
+ export function createAssetImage(src) {
52
+ return __awaiter(this, void 0, void 0, function () {
53
+ return __generator(this, function (_a) {
54
+ return [2 /*return*/, new Promise(function (res, rej) {
55
+ outofScopeP5.loadImage(src, res, rej);
56
+ })];
57
+ });
58
+ });
59
+ }
60
+ export function createAssetSound(src, type) {
61
+ return __awaiter(this, void 0, void 0, function () {
62
+ var media;
63
+ return __generator(this, function (_a) {
64
+ media = new Sound(type);
65
+ return [2 /*return*/, new Promise(function (res, rej) {
66
+ media.native.onloadedmetadata = function () {
67
+ res(media);
68
+ };
69
+ media.native.onerror = function (error) {
70
+ rej(error);
71
+ };
72
+ media.native.src = src;
73
+ })];
74
+ });
75
+ });
76
+ }
77
+ export function tick(delay) {
78
+ return __awaiter(this, void 0, void 0, function () {
79
+ return __generator(this, function (_a) {
80
+ return [2 /*return*/, new Promise(function (res) {
81
+ if (delay != null) {
82
+ setTimeout(res, delay);
83
+ }
84
+ else {
85
+ // wait forever
86
+ }
87
+ })];
88
+ });
89
+ });
90
+ }
91
+ export function copyProperties(source, target) {
92
+ for (var key in target) {
93
+ if (target[key] !== undefined) {
94
+ source[key] = target[key];
95
+ }
96
+ }
97
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-simple-game-engine",
3
- "version": "0.1.63",
3
+ "version": "0.1.66",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib",
@@ -9,22 +9,18 @@
9
9
  "@types/matter-js": "^0.17.7",
10
10
  "@types/p5": "^1.4.2",
11
11
  "matter-js": "^0.18.0",
12
- "p5": "^1.4.1",
13
- "react": "^18.0.0"
12
+ "p5": "^1.4.1"
14
13
  },
15
14
  "devDependencies": {
16
- "typescript": "^4.4.2",
15
+ "@types/react": "^18.0.17",
17
16
  "@types/node": "^16.7.13",
18
- "@types/react": "^18.0.0"
17
+ "typescript": "^4.4.2"
19
18
  },
20
19
  "scripts": {
21
20
  "build": "rm -rf lib && tsc -p ."
22
21
  },
23
22
  "files": [
24
- "/lib/index.js",
25
- "/lib/*/**/***.d.ts",
26
- "/lib/*/**.d.ts",
27
- "/lib/*.d.ts"
23
+ "/lib"
28
24
  ],
29
25
  "keywords": [
30
26
  "game engine",