react-simple-game-engine 0.0.1 → 0.0.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.
- package/README.md +0 -46
- package/lib/classes/animations/animation.d.ts +14 -0
- package/lib/classes/animations/animation.d.ts.map +1 -0
- package/lib/classes/animations/avatar.animation.d.ts +14 -0
- package/lib/classes/animations/avatar.animation.d.ts.map +1 -0
- package/lib/classes/animations/color.animation.d.ts +9 -0
- package/lib/classes/animations/color.animation.d.ts.map +1 -0
- package/lib/classes/camera.d.ts +14 -0
- package/lib/classes/camera.d.ts.map +1 -0
- package/lib/classes/entities/circle.entity.d.ts +14 -0
- package/lib/classes/entities/circle.entity.d.ts.map +1 -0
- package/lib/classes/entities/entity.d.ts +34 -0
- package/lib/classes/entities/entity.d.ts.map +1 -0
- package/lib/classes/entities/rect.entity.d.ts +16 -0
- package/lib/classes/entities/rect.entity.d.ts.map +1 -0
- package/lib/classes/logic-component.d.ts +8 -0
- package/lib/classes/logic-component.d.ts.map +1 -0
- package/lib/classes/scene-management.d.ts +19 -0
- package/lib/classes/scene-management.d.ts.map +1 -0
- package/lib/classes/scene.d.ts +30 -0
- package/lib/classes/scene.d.ts.map +1 -0
- package/lib/classes/sprites/avatar.sprite.d.ts +6 -0
- package/lib/classes/sprites/avatar.sprite.d.ts.map +1 -0
- package/lib/classes/sprites/color.sprite.d.ts +7 -0
- package/lib/classes/sprites/color.sprite.d.ts.map +1 -0
- package/lib/classes/sprites/sprite.d.ts +27 -0
- package/lib/classes/sprites/sprite.d.ts.map +1 -0
- package/lib/classes/world-management.d.ts +12 -0
- package/lib/classes/world-management.d.ts.map +1 -0
- package/lib/decorators/entity-tag.decor.d.ts +6 -0
- package/lib/decorators/entity-tag.decor.d.ts.map +1 -0
- package/lib/decorators/scene-tag.decor.d.ts +6 -0
- package/lib/decorators/scene-tag.decor.d.ts.map +1 -0
- package/lib/decorators/scene-ui.decor.d.ts +7 -0
- package/lib/decorators/scene-ui.decor.d.ts.map +1 -0
- package/lib/export-types.d.ts +9 -0
- package/lib/export-types.d.ts.map +1 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +3 -0
- package/lib/ui-components/SceneRunner.d.ts +10 -0
- package/lib/ui-components/SceneRunner.d.ts.map +1 -0
- package/lib/ui-components/ScenesProcess.d.ts +10 -0
- package/lib/ui-components/ScenesProcess.d.ts.map +1 -0
- package/lib/ui-components/Sketch.d.ts +12 -0
- package/lib/ui-components/Sketch.d.ts.map +1 -0
- package/lib/utils.d.ts +4 -0
- package/lib/utils.d.ts.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,46 +0,0 @@
|
|
1
|
-
# Getting Started with Create React App
|
2
|
-
|
3
|
-
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
|
4
|
-
|
5
|
-
## Available Scripts
|
6
|
-
|
7
|
-
In the project directory, you can run:
|
8
|
-
|
9
|
-
### `yarn start`
|
10
|
-
|
11
|
-
Runs the app in the development mode.\
|
12
|
-
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
|
13
|
-
|
14
|
-
The page will reload if you make edits.\
|
15
|
-
You will also see any lint errors in the console.
|
16
|
-
|
17
|
-
### `yarn test`
|
18
|
-
|
19
|
-
Launches the test runner in the interactive watch mode.\
|
20
|
-
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
|
21
|
-
|
22
|
-
### `yarn build`
|
23
|
-
|
24
|
-
Builds the app for production to the `build` folder.\
|
25
|
-
It correctly bundles React in production mode and optimizes the build for the best performance.
|
26
|
-
|
27
|
-
The build is minified and the filenames include the hashes.\
|
28
|
-
Your app is ready to be deployed!
|
29
|
-
|
30
|
-
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
|
31
|
-
|
32
|
-
### `yarn eject`
|
33
|
-
|
34
|
-
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
|
35
|
-
|
36
|
-
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
|
37
|
-
|
38
|
-
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
|
39
|
-
|
40
|
-
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
|
41
|
-
|
42
|
-
## Learn More
|
43
|
-
|
44
|
-
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
|
45
|
-
|
46
|
-
To learn React, check out the [React documentation](https://reactjs.org/).
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Sprite } from "../sprites/sprite";
|
2
|
+
export declare abstract class AnimationSprite<S = Sprite<any>> {
|
3
|
+
protected currentFrame: number;
|
4
|
+
protected _isRunning: boolean;
|
5
|
+
protected timeCounter: number;
|
6
|
+
delatime: number;
|
7
|
+
source: S;
|
8
|
+
set isRunning(_isRunning: boolean);
|
9
|
+
abstract initial(params: any): void;
|
10
|
+
draw(): void;
|
11
|
+
protected abstract checkFrameMax(): boolean;
|
12
|
+
protected abstract onDraw(): void;
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=animation.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../../../src/classes/animations/animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,8BAAsB,eAAe,CAAC,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC;IACnD,SAAS,CAAC,YAAY,EAAE,MAAM,CAAK;IACnC,SAAS,CAAC,UAAU,UAAQ;IAC5B,SAAS,CAAC,WAAW,SAAK;IAE1B,QAAQ,SAAU;IAClB,MAAM,EAAG,CAAC,CAAC;IAEX,IAAI,SAAS,CAAC,UAAU,EAAE,OAAO,EAOhC;IAED,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI;IAEnC,IAAI;IAgBJ,SAAS,CAAC,QAAQ,CAAC,aAAa,IAAI,OAAO;IAC3C,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI;CAClC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { AvatarSprite } from "../sprites/avatar.sprite";
|
2
|
+
import { AnimationSprite } from "./animation";
|
3
|
+
export declare class AvatarAnimationSprite extends AnimationSprite<AvatarSprite> {
|
4
|
+
private options;
|
5
|
+
initial({ offsetX, offsetY, ...options }: {
|
6
|
+
offsetX?: number;
|
7
|
+
offsetY?: number;
|
8
|
+
offsetWidth: number;
|
9
|
+
offsetHeight: number;
|
10
|
+
}): void;
|
11
|
+
protected checkFrameMax(): boolean;
|
12
|
+
onDraw(): void;
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=avatar.animation.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"avatar.animation.d.ts","sourceRoot":"","sources":["../../../src/classes/animations/avatar.animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,qBAAa,qBAAsB,SAAQ,eAAe,CAAC,YAAY,CAAC;IACtE,OAAO,CAAC,OAAO,CAKb;IAEF,OAAO,CAAC,EACN,OAAW,EACX,OAAW,EACX,GAAG,OAAO,EACX,EAAE;QACD,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;KACtB;IAQD,SAAS,CAAC,aAAa,IAAI,OAAO;IAOlC,MAAM;CAiBP"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { ColorSprite } from "../sprites/color.sprite";
|
2
|
+
import { AnimationSprite } from "./animation";
|
3
|
+
export declare class ColorAnimationSprite extends AnimationSprite<ColorSprite> {
|
4
|
+
private colors;
|
5
|
+
initial(colors: ColorSprite["sprite"][]): void;
|
6
|
+
protected checkFrameMax(): boolean;
|
7
|
+
protected onDraw(): void;
|
8
|
+
}
|
9
|
+
//# sourceMappingURL=color.animation.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"color.animation.d.ts","sourceRoot":"","sources":["../../../src/classes/animations/color.animation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,qBAAa,oBAAqB,SAAQ,eAAe,CAAC,WAAW,CAAC;IACpE,OAAO,CAAC,MAAM,CAA2B;IACzC,OAAO,CAAC,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,EAAE;IAIvC,SAAS,CAAC,aAAa,IAAI,OAAO;IAIlC,SAAS,CAAC,MAAM,IAAI,IAAI;CAGzB"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export declare class Camera {
|
2
|
+
private _width;
|
3
|
+
private _height;
|
4
|
+
x: number;
|
5
|
+
y: number;
|
6
|
+
scaleX: number;
|
7
|
+
scaleY: number;
|
8
|
+
constructor(_width: number, _height: number);
|
9
|
+
get width(): number;
|
10
|
+
get height(): number;
|
11
|
+
set width(width: number);
|
12
|
+
set height(height: number);
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=camera.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"camera.d.ts","sourceRoot":"","sources":["../../src/classes/camera.ts"],"names":[],"mappings":"AAAA,qBAAa,MAAM;IAML,OAAO,CAAC,MAAM;IAAU,OAAO,CAAC,OAAO;IALnD,CAAC,EAAE,MAAM,CAAK;IACd,CAAC,EAAE,MAAM,CAAK;IACd,MAAM,EAAE,MAAM,CAAK;IACnB,MAAM,EAAE,MAAM,CAAK;gBAEC,MAAM,EAAE,MAAM,EAAU,OAAO,EAAE,MAAM;IAE3D,IAAI,KAAK,IAQQ,MAAM,CANtB;IAED,IAAI,MAAM,IASS,MAAM,CAPxB;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,EAGtB;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAGxB;CACF"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { Body } from "matter-js";
|
2
|
+
import { Entity } from "./entity";
|
3
|
+
export declare class CircleEntity extends Entity {
|
4
|
+
radius: number;
|
5
|
+
onSpriteWidthHeightBinding(): {
|
6
|
+
width: number;
|
7
|
+
height: number;
|
8
|
+
};
|
9
|
+
protected onInitial(): EntityInitial<CircleEntity>;
|
10
|
+
protected onCreateBody(transform: CreateBodyDefine["transform"] & {
|
11
|
+
radius: number;
|
12
|
+
}, options?: CreateBodyDefine["bodyOptions"]): Body;
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=circle.entity.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"circle.entity.d.ts","sourceRoot":"","sources":["../../../src/classes/entities/circle.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAU,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,YAAa,SAAQ,MAAM;IAC/B,MAAM,EAAG,MAAM,CAAC;IAEvB,0BAA0B,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAO/D,SAAS,CAAC,SAAS,IAAI,aAAa,CAAC,YAAY,CAAC;IAQlD,SAAS,CAAC,YAAY,CACpB,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EAC7D,OAAO,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,GACxC,IAAI;CAIR"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import Matter from "matter-js";
|
2
|
+
import { Camera } from "../camera";
|
3
|
+
import { WorldManagement } from "../world-management";
|
4
|
+
import { EntityPrepare, MasterBody, Sound } from "../../export-types";
|
5
|
+
export declare abstract class Entity {
|
6
|
+
private _body;
|
7
|
+
private _sprite;
|
8
|
+
private readonly id;
|
9
|
+
readonly tag: string;
|
10
|
+
camera: Camera;
|
11
|
+
protected worldManagement: WorldManagement;
|
12
|
+
protected sound?: Sound;
|
13
|
+
constructor();
|
14
|
+
set sprite(sprite: ISprite);
|
15
|
+
get sprite(): ISprite;
|
16
|
+
get position(): Matter.Vector;
|
17
|
+
get body(): MasterBody;
|
18
|
+
active(worldManagement: WorldManagement): void;
|
19
|
+
onActive(): void;
|
20
|
+
createBody(transform: CreateBodyDefine["transform"], options?: CreateBodyDefine["bodyOptions"]): MasterBody;
|
21
|
+
protected abstract onCreateBody(transform: CreateBodyDefine["transform"] | undefined, options?: CreateBodyDefine["bodyOptions"]): Matter.Body;
|
22
|
+
initial({ sound, transform, sprite: spriteComponent, bodyOptions, }: EntityInitial<this>): void;
|
23
|
+
protected abstract onInitial(): EntityInitial<this>;
|
24
|
+
protected onPrepare(): EntityPrepare<this>;
|
25
|
+
update(): void;
|
26
|
+
onUpdate(): void;
|
27
|
+
draw(): void;
|
28
|
+
abstract onSpriteWidthHeightBinding(): {
|
29
|
+
width: number;
|
30
|
+
height: number;
|
31
|
+
};
|
32
|
+
onCollision(target: Entity): void;
|
33
|
+
}
|
34
|
+
//# sourceMappingURL=entity.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../../../src/classes/entities/entity.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEtE,8BAAsB,MAAM;IAC1B,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,OAAO,CAAW;IAC1B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAsD;IAEzE,SAAgB,GAAG,EAAG,MAAM,CAAC;IACtB,MAAM,EAAG,MAAM,CAAC;IAEvB,SAAS,CAAC,eAAe,EAAG,eAAe,CAAC;IAC5C,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;;IAMxB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAGzB;IAED,IAAI,MAAM,IALS,OAAO,CAOzB;IAED,IAAI,QAAQ,kBAEX;IAED,IAAI,IAAI,eAEP;IAED,MAAM,CAAC,eAAe,EAAE,eAAe;IAKvC,QAAQ;IAER,UAAU,CACR,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,EACxC,OAAO,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC;IAO3C,SAAS,CAAC,QAAQ,CAAC,YAAY,CAC7B,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,SAAS,EACpD,OAAO,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,GACxC,MAAM,CAAC,IAAI;IAEd,OAAO,CAAC,EACN,KAAK,EACL,SAAc,EACd,MAAM,EAAE,eAAe,EACvB,WAAgB,GACjB,EAAE,aAAa,CAAC,IAAI,CAAC;IA+BtB,SAAS,CAAC,QAAQ,CAAC,SAAS,IAAI,aAAa,CAAC,IAAI,CAAC;IACnD,SAAS,CAAC,SAAS,IAAI,aAAa,CAAC,IAAI,CAAC;IAI1C,MAAM;IAGN,QAAQ;IAER,IAAI;IAIJ,QAAQ,CAAC,0BAA0B,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAExE,WAAW,CAAC,MAAM,EAAE,MAAM;CAC3B"}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { Body } from "matter-js";
|
2
|
+
import { Entity } from "./entity";
|
3
|
+
export declare class RectEntity extends Entity {
|
4
|
+
width: number;
|
5
|
+
height: number;
|
6
|
+
onSpriteWidthHeightBinding(): {
|
7
|
+
width: number;
|
8
|
+
height: number;
|
9
|
+
};
|
10
|
+
protected onInitial(): EntityInitial<RectEntity>;
|
11
|
+
protected onCreateBody(transform: CreateBodyDefine["transform"] & {
|
12
|
+
width: number;
|
13
|
+
height: number;
|
14
|
+
}, options?: CreateBodyDefine["bodyOptions"]): Body;
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=rect.entity.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"rect.entity.d.ts","sourceRoot":"","sources":["../../../src/classes/entities/rect.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,IAAI,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,UAAW,SAAQ,MAAM;IAC7B,KAAK,EAAG,MAAM,CAAC;IACf,MAAM,EAAG,MAAM,CAAC;IAEvB,0BAA0B,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE;IAO/D,SAAS,CAAC,SAAS,IAAI,aAAa,CAAC,UAAU,CAAC;IAShD,SAAS,CAAC,YAAY,CACpB,SAAS,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG;QACzC,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,EACD,OAAO,CAAC,EAAE,gBAAgB,CAAC,aAAa,CAAC,GACxC,IAAI;CAWR"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"logic-component.d.ts","sourceRoot":"","sources":["../../src/classes/logic-component.ts"],"names":[],"mappings":"AAAA,qBAAa,cAAc,CAAC,CAAC,SAAS;IAAE,OAAO,EAAE,GAAG,CAAA;CAAE,GAAG,OAAO;IAC9D,OAAO,CAAC,QAAQ,CAAI;gBACR,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAOpC,MAAM;CAGP"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Scene } from "./scene";
|
2
|
+
declare type ChangeSceneListener = (scene: Scene) => void;
|
3
|
+
export declare class SceneManagement {
|
4
|
+
private Scenes;
|
5
|
+
private _currentScene;
|
6
|
+
private changeSceneListener;
|
7
|
+
static getTag(Scene: {
|
8
|
+
tag?: string;
|
9
|
+
}): string | undefined;
|
10
|
+
constructor(Scenes: {
|
11
|
+
new (): Scene;
|
12
|
+
tag?: string;
|
13
|
+
}[]);
|
14
|
+
get currentScene(): Scene<any>;
|
15
|
+
onChangeScene(func: ChangeSceneListener): void;
|
16
|
+
gotoScene(tag: string): void;
|
17
|
+
}
|
18
|
+
export {};
|
19
|
+
//# sourceMappingURL=scene-management.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scene-management.d.ts","sourceRoot":"","sources":["../../src/classes/scene-management.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,aAAK,mBAAmB,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;AAClD,qBAAa,eAAe;IAOd,OAAO,CAAC,MAAM;IAN1B,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,mBAAmB,CAAuB;IAClD,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE;gBAIjB,MAAM,EAAE;QAAE,QAAQ,KAAK,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE;IAK7D,IAAI,YAAY,eAEf;IAED,aAAa,CAAC,IAAI,EAAE,mBAAmB;IAIvC,SAAS,CAAC,GAAG,EAAE,MAAM;CActB"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { ComponentType } from "react";
|
2
|
+
import { Camera } from "./camera";
|
3
|
+
import { LogicComponent } from "./logic-component";
|
4
|
+
import { SceneManagement } from "./scene-management";
|
5
|
+
declare type LoadAssetsListener = (loadedAssets: boolean) => void;
|
6
|
+
export declare abstract class Scene<UIP = any> {
|
7
|
+
private ui;
|
8
|
+
private worldManagement;
|
9
|
+
private _loadedAssets;
|
10
|
+
private loadAssetsListener;
|
11
|
+
tag: string;
|
12
|
+
manager: SceneManagement;
|
13
|
+
readonly sessionId: string;
|
14
|
+
abstract getComponents(): LogicComponent[];
|
15
|
+
constructor();
|
16
|
+
get UI(): ComponentType<UIP>;
|
17
|
+
get UIProps(): UIP;
|
18
|
+
protected getUIProps(): UIP;
|
19
|
+
get loadedAssets(): boolean;
|
20
|
+
onLoadAssetNotify(func: LoadAssetsListener): void;
|
21
|
+
destructor(): void;
|
22
|
+
setLoadAssetStatus(loadedAssets: boolean): void;
|
23
|
+
switchToScene(tag: string): void;
|
24
|
+
loadAssets(): Promise<void>;
|
25
|
+
onLoadAssets(): Promise<void>;
|
26
|
+
bootstrap(camera: Camera): void;
|
27
|
+
action(): void;
|
28
|
+
}
|
29
|
+
export {};
|
30
|
+
//# sourceMappingURL=scene.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../src/classes/scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrD,aAAK,kBAAkB,GAAG,CAAC,YAAY,EAAE,OAAO,KAAK,IAAI,CAAC;AAE1D,8BAAsB,KAAK,CAAC,GAAG,GAAG,GAAG;IACnC,OAAO,CAAC,EAAE,CAAqB;IAC/B,OAAO,CAAC,eAAe,CAAmB;IAC1C,OAAO,CAAC,aAAa,CAAW;IAChC,OAAO,CAAC,kBAAkB,CAAsB;IAEzC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAG,eAAe,CAAC;IACjC,SAAgB,SAAS,EAAE,MAAM,CAA8C;aAC/D,aAAa,IAAI,cAAc,EAAE;;IAQjD,IAAI,EAAE,uBAGL;IAED,IAAI,OAAO,QAEV;IAED,SAAS,CAAC,UAAU;IAIpB,IAAI,YAAY,YAEf;IAED,iBAAiB,CAAC,IAAI,EAAE,kBAAkB;IAI1C,UAAU;IAIV,kBAAkB,CAAC,YAAY,EAAE,OAAO;IAKxC,aAAa,CAAC,GAAG,EAAE,MAAM;IAInB,UAAU;IAQV,YAAY;IAElB,SAAS,CAAC,MAAM,EAAE,MAAM;IAUxB,MAAM;CAIP"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"avatar.sprite.d.ts","sourceRoot":"","sources":["../../../src/classes/sprites/avatar.sprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,YAAa,SAAQ,MAAM,CAAC,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IACjE,MAAM;CAqBP"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"color.sprite.d.ts","sourceRoot":"","sources":["../../../src/classes/sprites/color.sprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,WAAY,SAAQ,MAAM,CAAC,KAAK,CAAC;;IAK5C,MAAM;CAYP"}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { AnimationSprite } from "../animations/animation";
|
2
|
+
import { Entity } from "../entities/entity";
|
3
|
+
import { LogicComponent } from "../logic-component";
|
4
|
+
declare type GetInitialParams<S extends {
|
5
|
+
sprite?: any;
|
6
|
+
} = any> = {
|
7
|
+
sprite?: S["sprite"];
|
8
|
+
animation?: LogicComponent<AnimationSprite>;
|
9
|
+
};
|
10
|
+
export declare abstract class Sprite<SpriteType> {
|
11
|
+
sprite: SpriteType;
|
12
|
+
private _entity;
|
13
|
+
private _width;
|
14
|
+
private _height;
|
15
|
+
private _animation;
|
16
|
+
set animation(ani: AnimationSprite);
|
17
|
+
get animation(): AnimationSprite;
|
18
|
+
set entity(entity: Entity);
|
19
|
+
get entity(): Entity;
|
20
|
+
get width(): number;
|
21
|
+
get height(): number;
|
22
|
+
draw(): void;
|
23
|
+
abstract onDraw(): void;
|
24
|
+
initial(params?: GetInitialParams<this>): void;
|
25
|
+
}
|
26
|
+
export {};
|
27
|
+
//# sourceMappingURL=sprite.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"sprite.d.ts","sourceRoot":"","sources":["../../../src/classes/sprites/sprite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,aAAK,gBAAgB,CAAC,CAAC,SAAS;IAAE,MAAM,CAAC,EAAE,GAAG,CAAA;CAAE,GAAG,GAAG,IAAI;IACxD,MAAM,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;IACrB,SAAS,CAAC,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;CAC7C,CAAC;AAEF,8BAAsB,MAAM,CAAC,UAAU;IAC9B,MAAM,EAAG,UAAU,CAAC;IAC3B,OAAO,CAAC,OAAO,CAAU;IACzB,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,OAAO,CAAU;IAEzB,OAAO,CAAC,UAAU,CAA8B;IAEhD,IAAI,SAAS,CAAC,GAAG,EAAE,eAAe,EAGjC;IAED,IAAI,SAAS,IAAI,eAAe,CAE/B;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAKxB;IAED,IAAI,MAAM,IAPS,MAAM,CASxB;IAED,IAAI,KAAK,WAER;IAED,IAAI,MAAM,WAET;IAED,IAAI;IAUJ,QAAQ,CAAC,MAAM,IAAI,IAAI;IAEvB,OAAO,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC;CAexC"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { Entity } from "./entities/entity";
|
2
|
+
export declare class WorldManagement {
|
3
|
+
private entities;
|
4
|
+
private engine;
|
5
|
+
constructor();
|
6
|
+
destructor(): void;
|
7
|
+
addEntity(entity: Entity): void;
|
8
|
+
removeEntity(entity: Entity): void;
|
9
|
+
update(): void;
|
10
|
+
draw(): void;
|
11
|
+
}
|
12
|
+
//# sourceMappingURL=world-management.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"world-management.d.ts","sourceRoot":"","sources":["../../src/classes/world-management.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,MAAM,CAAU;;IAgBxB,UAAU;IAKV,SAAS,CAAC,MAAM,EAAE,MAAM;IAMxB,YAAY,CAAC,MAAM,EAAE,MAAM;IAK3B,MAAM;IAON,IAAI;CAML"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"entity-tag.decor.d.ts","sourceRoot":"","sources":["../../src/decorators/entity-tag.decor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEpD,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,YACV;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,MAAM,CAAA;CAAE,UAG1D"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scene-tag.decor.d.ts","sourceRoot":"","sources":["../../src/decorators/scene-tag.decor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,YACT;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,KAAK,CAAA;CAAE,UAGzD"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"scene-ui.decor.d.ts","sourceRoot":"","sources":["../../src/decorators/scene-ui.decor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,wBAAgB,OAAO,CAAC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC,YACnB;IAAE,EAAE,CAAC,EAAE,cAAc,GAAG,CAAC,CAAC;IAAC,QAAQ,KAAK,CAAA;CAAE,UAGpE"}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/// <reference types="matter-js" />
|
2
|
+
export declare type Sound = HTMLAudioElement;
|
3
|
+
export declare type Avatar = ReturnType<P5["loadImage"]>;
|
4
|
+
export declare type Color = [number, number, number, number?];
|
5
|
+
export declare type EntityPrepare<E extends IEntity> = EntityInitial<E>;
|
6
|
+
export declare type MasterBody = Matter.Body & {
|
7
|
+
entity: IEntity;
|
8
|
+
};
|
9
|
+
//# sourceMappingURL=export-types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"export-types.d.ts","sourceRoot":"","sources":["../src/export-types.ts"],"names":[],"mappings":";AAAA,oBAAY,KAAK,GAAG,gBAAgB,CAAC;AACrC,oBAAY,MAAM,GAAG,UAAU,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;AACjD,oBAAY,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEtD,oBAAY,aAAa,CAAC,CAAC,SAAS,OAAO,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;AAChE,oBAAY,UAAU,GAAG,MAAM,CAAC,IAAI,GAAG;IACrC,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
|
package/lib/index.d.ts
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
/// <reference types="p5" />
|
2
|
+
export { createAssetImage, createAssetSound } from "./utils";
|
3
|
+
export { AnimationSprite } from "./classes/animations/animation";
|
4
|
+
export { AvatarAnimationSprite } from "./classes/animations/avatar.animation";
|
5
|
+
export { ColorAnimationSprite } from "./classes/animations/color.animation";
|
6
|
+
export { Entity } from "./classes/entities/entity";
|
7
|
+
export { CircleEntity } from "./classes/entities/circle.entity";
|
8
|
+
export { RectEntity } from "./classes/entities/rect.entity";
|
9
|
+
export { LogicComponent } from "./classes/logic-component";
|
10
|
+
export { Sprite } from "./classes/sprites/sprite";
|
11
|
+
export { AvatarSprite } from "./classes/sprites/avatar.sprite";
|
12
|
+
export { ColorSprite } from "./classes/sprites/color.sprite";
|
13
|
+
export { Scene } from "./classes/scene";
|
14
|
+
export { EntityTag } from "./decorators/entity-tag.decor";
|
15
|
+
export { SceneTag } from "./decorators/scene-tag.decor";
|
16
|
+
export { SceneUI } from "./decorators/scene-ui.decor";
|
17
|
+
export { ScenesProcess } from "./ui-components/ScenesProcess";
|
18
|
+
export * from "./export-types";
|
19
|
+
export declare const Renderer: import("p5");
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,uCAAuC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAE7D,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,cAAc,gBAAgB,CAAC;AAE/B,eAAO,MAAM,QAAQ,cAAkB,CAAC"}
|
package/lib/index.js
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
export { createAssetImage, createAssetSound } from "./utils";
|
2
|
+
export { AnimationSprite } from "./classes/animations/animation";
|
2
3
|
export { AvatarAnimationSprite } from "./classes/animations/avatar.animation";
|
3
4
|
export { ColorAnimationSprite } from "./classes/animations/color.animation";
|
5
|
+
export { Entity } from "./classes/entities/entity";
|
4
6
|
export { CircleEntity } from "./classes/entities/circle.entity";
|
5
7
|
export { RectEntity } from "./classes/entities/rect.entity";
|
6
8
|
export { LogicComponent } from "./classes/logic-component";
|
9
|
+
export { Sprite } from "./classes/sprites/sprite";
|
7
10
|
export { AvatarSprite } from "./classes/sprites/avatar.sprite";
|
8
11
|
export { ColorSprite } from "./classes/sprites/color.sprite";
|
9
12
|
export { Scene } from "./classes/scene";
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { Scene } from "../classes/scene";
|
3
|
+
declare type SceneRunnerProps = {
|
4
|
+
current: Scene;
|
5
|
+
width: number;
|
6
|
+
height: number;
|
7
|
+
};
|
8
|
+
export declare function SceneRunner({ current, width, height }: SceneRunnerProps): JSX.Element;
|
9
|
+
export {};
|
10
|
+
//# sourceMappingURL=SceneRunner.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"SceneRunner.d.ts","sourceRoot":"","sources":["../../src/ui-components/SceneRunner.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAGzC,aAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,gBAAgB,eAiCvE"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { SceneManagement } from "../classes/scene-management";
|
3
|
+
declare type WorldViewProps = {
|
4
|
+
list: ConstructorParameters<typeof SceneManagement>[0];
|
5
|
+
width: number;
|
6
|
+
height: number;
|
7
|
+
};
|
8
|
+
export declare function ScenesProcess({ list, width, height }: WorldViewProps): JSX.Element;
|
9
|
+
export {};
|
10
|
+
//# sourceMappingURL=ScenesProcess.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ScenesProcess.d.ts","sourceRoot":"","sources":["../../src/ui-components/ScenesProcess.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,aAAK,cAAc,GAAG;IACpB,IAAI,EAAE,qBAAqB,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,cAAc,eA+BpE"}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { Camera } from "../classes/camera";
|
3
|
+
declare type SketchProps = {
|
4
|
+
onSetup: (camera: Camera) => void;
|
5
|
+
onDraw: () => void;
|
6
|
+
onPreload?: () => void;
|
7
|
+
width: number;
|
8
|
+
height: number;
|
9
|
+
};
|
10
|
+
export declare function Sketch({ onSetup, onDraw, onPreload, width, height, }: SketchProps): JSX.Element;
|
11
|
+
export {};
|
12
|
+
//# sourceMappingURL=Sketch.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Sketch.d.ts","sourceRoot":"","sources":["../../src/ui-components/Sketch.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,aAAK,WAAW,GAAG;IACjB,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,MAAM,GACP,EAAE,WAAW,eAgDb"}
|
package/lib/utils.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAiB/C,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAInE;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAWlE"}
|