@safe-engine/pixi 8.3.1 → 8.3.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 +72 -3
- package/dist/@types/safex.d.ts +2 -155
- package/dist/app.d.ts +1 -1
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +13 -4
- package/dist/base/EnhancedComponent.d.ts +5 -15
- package/dist/base/EnhancedComponent.d.ts.map +1 -1
- package/dist/base/EnhancedComponent.js +4 -2
- package/dist/collider/CollideComponent.d.ts +20 -18
- package/dist/collider/CollideComponent.d.ts.map +1 -1
- package/dist/collider/CollideComponent.js +12 -35
- package/dist/collider/CollideSystem.js +12 -12
- package/dist/components/BaseComponent.d.ts +2 -2
- package/dist/components/BaseComponent.d.ts.map +1 -1
- package/dist/components/NodeComp.d.ts +2 -2
- package/dist/components/NodeComp.d.ts.map +1 -1
- package/dist/components/NodeComp.js +1 -1
- package/dist/dragonbones/DragonBonesComponent.d.ts +22 -6
- package/dist/dragonbones/DragonBonesComponent.d.ts.map +1 -1
- package/dist/dragonbones/DragonBonesComponent.js +0 -4
- package/dist/dragonbones/DragonBonesSystem.js +1 -1
- package/dist/gui/GUIComponent.d.ts +29 -22
- package/dist/gui/GUIComponent.d.ts.map +1 -1
- package/dist/gui/GUIComponent.js +12 -16
- package/dist/gui/GUISystem.js +24 -24
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/norender/NoRenderComponent.d.ts +7 -7
- package/dist/norender/NoRenderComponent.d.ts.map +1 -1
- package/dist/norender/NoRenderComponent.js +0 -12
- package/dist/norender/NoRenderSystem.js +13 -13
- package/dist/planck/PhysicsComponent.d.ts +30 -17
- package/dist/planck/PhysicsComponent.d.ts.map +1 -1
- package/dist/planck/PhysicsComponent.js +0 -35
- package/dist/planck/PhysicsSystem.d.ts.map +1 -1
- package/dist/planck/PhysicsSystem.js +16 -18
- package/dist/render/RenderComponent.d.ts +22 -17
- package/dist/render/RenderComponent.d.ts.map +1 -1
- package/dist/render/RenderComponent.js +10 -19
- package/dist/render/RenderSystem.d.ts.map +1 -1
- package/dist/render/RenderSystem.js +9 -12
- package/dist/spine/SpineComponent.d.ts +13 -6
- package/dist/spine/SpineComponent.d.ts.map +1 -1
- package/dist/spine/SpineSystem.js +1 -1
- package/dist/spine/lib/Spine.d.ts +1 -1
- package/dist/spine/lib/Spine.d.ts.map +1 -1
- package/dist/spine/lib/Spine.js +2 -2
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,10 +1,79 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
# Safex = JSX + PixiJS Game Engine
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
Safex is an open-source game engine written in TypeScript, combining the power of JSX syntax with the renowned PixiJS rendering library. This project aims to help game developers build games quickly, easily, and intuitively.
|
|
6
|
+
|
|
7
|
+
## Key Features
|
|
8
|
+
|
|
9
|
+
- **JSX Syntax:** Write UI and game logic in a React-like style for better code organization and readability.
|
|
10
|
+
- **Powered by PixiJS:** Utilize PixiJS for high-performance 2D rendering.
|
|
11
|
+
- **Component-based Architecture:** Easily manage game elements such as scenes, sprites, and animations.
|
|
12
|
+
- **Asset Loading Support:** Quickly load images, sounds, and spritesheets.
|
|
13
|
+
- All components must be extends from `ComponentX` or `NoRenderComponentX`
|
|
3
14
|
- `NoRenderComponentX` will append to component of parent node have `ComponentX`, `ComponentX` will be `addChild` to parent node
|
|
4
15
|
- `node` property represent node, and can pass properties to assign
|
|
5
|
-
-
|
|
16
|
+
- Example `<SpriteRender node={{ x: 5, y: 9 }} />`
|
|
6
17
|
- `$ref` bind component with current class property as string
|
|
7
18
|
- `$push` push component to list
|
|
8
19
|
- `Array(2).map(_, i)` iteration repeat component 2 times
|
|
9
20
|
- `Loading.listItems.map(item, i)` iteration in static property
|
|
10
21
|
- `listItems.map(item, i)` iteration in const variable
|
|
22
|
+
|
|
23
|
+
## Benefits
|
|
24
|
+
|
|
25
|
+
- **Rapid Development:** JSX makes writing code clean and intuitive.
|
|
26
|
+
- **Extensibility:** Easily add new features and functionalities.
|
|
27
|
+
- **Web Developer Friendly:** If you're familiar with React, you'll quickly get up to speed with Safex.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```sh
|
|
32
|
+
npm install @safe-engine/pixi
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Basic Example
|
|
36
|
+
|
|
37
|
+
```tsx game.ts
|
|
38
|
+
import { addGameCanvasTo, loadScene, startGameSystems } from '@safe-engine/pixi'
|
|
39
|
+
async function start() {
|
|
40
|
+
await addGameCanvasTo('canvasId')
|
|
41
|
+
startGameSystems()
|
|
42
|
+
loadScene(GameScene)
|
|
43
|
+
}
|
|
44
|
+
start()
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
```tsx GameScene.tsx
|
|
48
|
+
import { SceneComponent, LabelComp, ButtonComp, SpriteRender } from '@safe-engine/pixi'
|
|
49
|
+
|
|
50
|
+
export class GameScene extends ComponentX {
|
|
51
|
+
sprite: SpriteRender
|
|
52
|
+
|
|
53
|
+
onPress() {
|
|
54
|
+
this.sprite.spriteFrame = 'other.sprite.png'
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
render() {
|
|
58
|
+
return (
|
|
59
|
+
<SceneComponent>
|
|
60
|
+
<LabelComp node={{ x: 106, y: 240 }} string="Hello safex" font={defaultFont} />
|
|
61
|
+
<SpriteRender $ref={this.sprite} node={{ x: 500, y: 600 }} spriteFrame={'path/to/sprite.png'}>
|
|
62
|
+
<ButtonComp onPress={this.onPress} />
|
|
63
|
+
</SpriteRender>
|
|
64
|
+
</SceneComponent>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Contributing
|
|
71
|
+
|
|
72
|
+
We welcome all contributions! If you have ideas or want to improve the engine, feel free to create an issue or submit a pull request on GitHub.
|
|
73
|
+
|
|
74
|
+
## Contact
|
|
75
|
+
|
|
76
|
+
- [GitHub](https://github.com/Safe-engine/safex-pixi)
|
|
77
|
+
- [Discord](https://discord.com/channels/1344214207268388979/1344214208044208140)
|
|
78
|
+
|
|
79
|
+
Let's build a powerful and convenient game engine together! 🚀
|
package/dist/@types/safex.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Color4B } from "../core/Color";
|
|
1
|
+
import { NodeComp } from "..";
|
|
3
2
|
|
|
4
3
|
interface BaseComponentProps {
|
|
5
4
|
$ref?: object;
|
|
5
|
+
$refNode?: NodeComp<any>
|
|
6
6
|
$push?: object[];
|
|
7
7
|
node?: Partial<NodeComp>;
|
|
8
8
|
}
|
|
@@ -11,158 +11,5 @@ interface NodeCompProps {
|
|
|
11
11
|
nodeName?: string
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
interface SpriteRenderProps {
|
|
15
|
-
spriteFrame: string
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface GraphicsRenderProps {
|
|
19
|
-
lineWidth?: number
|
|
20
|
-
strokeColor?: Color4B
|
|
21
|
-
fillColor?: Color4B
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
interface MaskRenderProps {
|
|
25
|
-
type?: number
|
|
26
|
-
segments?: number
|
|
27
|
-
inverted?: boolean
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
interface ProgressTimerProps {
|
|
31
|
-
spriteFrame: string
|
|
32
|
-
fillType?: number
|
|
33
|
-
fillRange?: number
|
|
34
|
-
fillCenter?: Point
|
|
35
|
-
isReverse?: boolean
|
|
36
|
-
}
|
|
37
|
-
|
|
38
14
|
interface LoadingBarProps {
|
|
39
15
|
}
|
|
40
|
-
|
|
41
|
-
interface LabelCompProps {
|
|
42
|
-
font?: string
|
|
43
|
-
string?: string
|
|
44
|
-
size?: number
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
interface ScrollViewProps {
|
|
48
|
-
width: number
|
|
49
|
-
height: number
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
interface LabelOutlineCompProps {
|
|
53
|
-
color: Color4B
|
|
54
|
-
width: number
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
interface LabelShadowCompProps {
|
|
58
|
-
color: Color4B
|
|
59
|
-
blur: number
|
|
60
|
-
offset: Point
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
interface ColliderProps {
|
|
64
|
-
offset?: Point
|
|
65
|
-
tag?: number
|
|
66
|
-
enabled?: boolean
|
|
67
|
-
onCollisionEnter?: (other: Collider) => void
|
|
68
|
-
onCollisionExit?: (other: Collider) => void
|
|
69
|
-
onCollisionStay?: (other: Collider) => void
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
interface BoxColliderProps extends ColliderProps {
|
|
73
|
-
width: number
|
|
74
|
-
height: number
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
interface CircleColliderProps extends ColliderProps {
|
|
78
|
-
radius: number
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
interface PolygonColliderProps extends ColliderProps {
|
|
82
|
-
points: Array<Point>
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
interface SpineData {
|
|
86
|
-
atlas: string
|
|
87
|
-
skeleton: string
|
|
88
|
-
texture?: string
|
|
89
|
-
}
|
|
90
|
-
interface SpineSkeletonProps {
|
|
91
|
-
data: SpineData
|
|
92
|
-
skin?: string
|
|
93
|
-
animation?: string
|
|
94
|
-
timeScale?: number
|
|
95
|
-
loop?: boolean
|
|
96
|
-
}
|
|
97
|
-
interface DragonBonesData {
|
|
98
|
-
atlas: string
|
|
99
|
-
skeleton: string
|
|
100
|
-
texture: string
|
|
101
|
-
}
|
|
102
|
-
interface DragonBonesProps {
|
|
103
|
-
data: DragonBonesData
|
|
104
|
-
skin?: string
|
|
105
|
-
animation?: string
|
|
106
|
-
playTimes?: number
|
|
107
|
-
timeScale?: number
|
|
108
|
-
onAnimationStart?: (event: { name: string }) => void
|
|
109
|
-
onAnimationEnd?: (event: { name: string }) => void
|
|
110
|
-
onAnimationComplete?: (event: { name: string }) => void
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
interface ExtraDataProps {
|
|
114
|
-
key: string
|
|
115
|
-
value: any
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
interface ButtonCompProps {
|
|
119
|
-
normalImage?: string
|
|
120
|
-
selectedImage?: string
|
|
121
|
-
disableImage?: string
|
|
122
|
-
zoomScale?: number
|
|
123
|
-
onPress: (target: ButtonComp) => void
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
interface TouchEventProps {
|
|
127
|
-
onTouchStart?: TouchEventCallback
|
|
128
|
-
onTouchMove?: TouchEventCallback
|
|
129
|
-
onTouchEnd?: TouchEventCallback
|
|
130
|
-
onTouchCancel?: TouchEventCallback
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export type BodyType = 'kinematic' | 'dynamic' | 'static'
|
|
134
|
-
interface RigidBodyProps {
|
|
135
|
-
type?: BodyType
|
|
136
|
-
density?: Float
|
|
137
|
-
restitution?: Float
|
|
138
|
-
friction?: Float
|
|
139
|
-
gravityScale?: Float
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
interface PhysicsMaterialProps {
|
|
143
|
-
friction?: number
|
|
144
|
-
restitution?: number
|
|
145
|
-
density?: number
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
interface ColliderPhysicsProps {
|
|
149
|
-
tag?: number
|
|
150
|
-
group?: number
|
|
151
|
-
offset?: Vec2
|
|
152
|
-
onCollisionEnter?: (other: Collider) => void
|
|
153
|
-
onCollisionExit?: (other: Collider) => void
|
|
154
|
-
onCollisionStay?: (other: Collider) => void
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
interface BoxColliderPhysicsProps extends ColliderPhysicsProps {
|
|
158
|
-
width: number
|
|
159
|
-
height: number
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
interface CircleColliderPhysicsProps extends ColliderPhysicsProps {
|
|
163
|
-
radius: number
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
interface PolygonColliderPhysicsProps extends ColliderPhysicsProps {
|
|
167
|
-
points: Array<Vec2>
|
|
168
|
-
}
|
package/dist/app.d.ts
CHANGED
package/dist/app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AASrC,eAAO,MAAM,GAAG,yCAAoB,CAAA;AAEpC,wBAAsB,eAAe,CAAC,EAAE,SAAS,iBAoBhD;AAED,wBAAgB,eAAe,CAAC,kBAAkB;;;CAA+B,QAKhF;AAaD,wBAAgB,gBAAgB,CAAC,IAAI,QAAK,QAezC"}
|
package/dist/app.js
CHANGED
|
@@ -14,7 +14,6 @@ import { CollideSystem } from './collider';
|
|
|
14
14
|
import { DragonBonesSystem } from './dragonbones';
|
|
15
15
|
import { GUISystem } from './gui/GUISystem';
|
|
16
16
|
import { NoRenderSystem } from './norender/NoRenderSystem';
|
|
17
|
-
import { PhysicsSystem } from './planck';
|
|
18
17
|
import { RenderSystem } from './render/RenderSystem';
|
|
19
18
|
import { SpineSystem } from './spine';
|
|
20
19
|
export const app = new Application();
|
|
@@ -34,6 +33,11 @@ export function addGameCanvasTo() {
|
|
|
34
33
|
canvas: document.getElementById(id)
|
|
35
34
|
});
|
|
36
35
|
// GameWorld.Instance.setup(NodeComp, app.stage)
|
|
36
|
+
Object.assign(app.canvas.style, {
|
|
37
|
+
width: `${window.innerWidth}px`,
|
|
38
|
+
height: `${window.innerHeight}px`,
|
|
39
|
+
overflow: 'visible',
|
|
40
|
+
});
|
|
37
41
|
});
|
|
38
42
|
}
|
|
39
43
|
export function setupResolution(designedResolution = { width: 720, height: 1280 }) {
|
|
@@ -51,15 +55,20 @@ function startGameLoop(world) {
|
|
|
51
55
|
});
|
|
52
56
|
// app.ticker.speed = 0.5
|
|
53
57
|
}
|
|
54
|
-
const systemsList = [RenderSystem, GUISystem, SpineSystem, DragonBonesSystem, CollideSystem,
|
|
55
|
-
export function startGameSystems() {
|
|
58
|
+
const systemsList = [RenderSystem, GUISystem, SpineSystem, DragonBonesSystem, CollideSystem, NoRenderSystem];
|
|
59
|
+
export function startGameSystems(list = []) {
|
|
56
60
|
const world = GameWorld.Instance;
|
|
57
61
|
systemsList.forEach(system => {
|
|
58
62
|
world.systems.add(system);
|
|
59
63
|
world.systems.configureOnce(system);
|
|
60
64
|
});
|
|
61
65
|
world.listUpdate.push(CollideSystem);
|
|
62
|
-
world.listUpdate.push(PhysicsSystem)
|
|
66
|
+
// world.listUpdate.push(PhysicsSystem)
|
|
67
|
+
list.forEach(system => {
|
|
68
|
+
world.systems.add(system);
|
|
69
|
+
world.systems.configureOnce(system);
|
|
70
|
+
world.listUpdate.push(system);
|
|
71
|
+
});
|
|
63
72
|
startGameLoop(world);
|
|
64
73
|
// console.log('startGameLoop', world.listUpdate)
|
|
65
74
|
}
|
|
@@ -1,26 +1,16 @@
|
|
|
1
|
-
import { Constructor
|
|
1
|
+
import { Constructor } from 'entityx-ts';
|
|
2
2
|
import { BaseComponentProps } from '../@types/safex';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
instance: C;
|
|
7
|
-
addComponent<T extends EnhancedComponent>(instance: T): T;
|
|
8
|
-
getComponent<T extends ComponentType>(component: Constructor<T>): T;
|
|
9
|
-
getComponentsInChildren<T extends ComponentType>(component: Constructor<T>): T[];
|
|
10
|
-
getComponentInChildren<T extends ComponentType>(component: Constructor<T>): T;
|
|
11
|
-
}
|
|
12
|
-
export declare class EnhancedComponent<Props = Object, N extends BaseNode<any> = BaseNode<any>> {
|
|
3
|
+
import { NodeComp } from '../components/NodeComp';
|
|
4
|
+
export declare class EnhancedComponent<Props = {}, N extends NodeComp<any> = NodeComp<any>> {
|
|
5
|
+
props: Props;
|
|
13
6
|
constructor(data?: BaseComponentProps & Props);
|
|
14
7
|
init(data?: Props): void;
|
|
15
8
|
node: N;
|
|
16
|
-
actionsMap: {
|
|
17
|
-
[key: string]: Animation;
|
|
18
|
-
};
|
|
19
9
|
addComponent<T extends EnhancedComponent>(instance: any): T;
|
|
20
10
|
getComponent<T extends ComponentType>(component: Constructor<T>): T;
|
|
21
11
|
getComponentsInChildren<T extends ComponentType>(component: Constructor<T>): T[];
|
|
22
12
|
getComponentInChildren<T extends ComponentType>(component: Constructor<T>): T;
|
|
23
13
|
isEqual(other: EnhancedComponent): boolean;
|
|
24
14
|
}
|
|
25
|
-
export type ComponentType = EnhancedComponent |
|
|
15
|
+
export type ComponentType = EnhancedComponent | NodeComp;
|
|
26
16
|
//# sourceMappingURL=EnhancedComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedComponent.d.ts","sourceRoot":"","sources":["../../src/base/EnhancedComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"EnhancedComponent.d.ts","sourceRoot":"","sources":["../../src/base/EnhancedComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAEjD,qBAAa,iBAAiB,CAAC,KAAK,GAAG,EAAE,EAAE,CAAC,SAAS,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC;IAChF,KAAK,EAAE,KAAK,CAAY;gBACZ,IAAI,CAAC,EAAE,kBAAkB,GAAG,KAAK;IAG7C,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK;IAQjB,IAAI,EAAE,CAAC,CAAA;IAEP,YAAY,CAAC,CAAC,SAAS,iBAAiB,EAAE,QAAQ,KAAA,GAAG,CAAC;IAGtD,YAAY,CAAC,CAAC,SAAS,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;IAGnE,uBAAuB,CAAC,CAAC,SAAS,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;IAGhF,sBAAsB,CAAC,CAAC,SAAS,aAAa,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC;IAG7E,OAAO,CAAC,KAAK,EAAE,iBAAiB;CAGjC;AAED,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,QAAQ,CAAA"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
export class EnhancedComponent {
|
|
2
2
|
constructor(data) {
|
|
3
|
-
this.
|
|
3
|
+
this.props = {};
|
|
4
|
+
this.init(data);
|
|
4
5
|
}
|
|
5
6
|
init(data) {
|
|
6
7
|
if (data) {
|
|
7
8
|
// console.log('constructor', this.constructor.name, data)
|
|
8
9
|
Object.keys(data).forEach((key) => {
|
|
9
|
-
this[key] = data[key];
|
|
10
|
+
this.props[key] = data[key];
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
13
|
}
|
|
14
|
+
// actionsMap: { [key: string]: Animation } = {}
|
|
13
15
|
addComponent(instance) {
|
|
14
16
|
return this.node.addComponent(instance);
|
|
15
17
|
}
|
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
import { Graphics, Point, Rectangle, Size } from 'pixi.js';
|
|
2
|
-
import { BoxColliderProps, CircleColliderProps, PolygonColliderProps } from '../@types/safex';
|
|
3
2
|
import { NoRenderComponentX } from '../components/BaseComponent';
|
|
4
|
-
|
|
5
|
-
offset
|
|
6
|
-
tag
|
|
7
|
-
enabled
|
|
3
|
+
interface ColliderProps {
|
|
4
|
+
offset?: Point;
|
|
5
|
+
tag?: number;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
onCollisionEnter?: (other: Collider) => void;
|
|
8
|
+
onCollisionExit?: (other: Collider) => void;
|
|
9
|
+
onCollisionStay?: (other: Collider) => void;
|
|
10
|
+
}
|
|
11
|
+
export declare class Collider<T = ColliderProps> extends NoRenderComponentX<T> {
|
|
8
12
|
_worldPoints: Point[];
|
|
9
13
|
_worldPosition: Point;
|
|
10
14
|
_worldRadius: any;
|
|
11
15
|
_AABB: Rectangle;
|
|
12
16
|
_preAabb: Rectangle;
|
|
13
|
-
onCollisionEnter?: (other: Collider) => void;
|
|
14
|
-
onCollisionExit?: (other: Collider) => void;
|
|
15
|
-
onCollisionStay?: (other: Collider) => void;
|
|
16
17
|
update(dt: number, draw?: Graphics): void;
|
|
17
18
|
getAABB(): Rectangle;
|
|
18
19
|
get world(): {
|
|
19
20
|
points: Point[];
|
|
20
21
|
preAabb: Rectangle;
|
|
21
22
|
};
|
|
22
|
-
setOnCollisionEnter(cb: (other: Collider) => void): void;
|
|
23
|
-
setOnCollisionExit(cb: (other: Collider) => void): void;
|
|
24
|
-
setOnCollisionStay(cb: (other: Collider) => void): void;
|
|
25
23
|
}
|
|
26
|
-
|
|
24
|
+
interface BoxColliderProps extends ColliderProps {
|
|
27
25
|
width: number;
|
|
28
26
|
height: number;
|
|
29
|
-
|
|
27
|
+
}
|
|
28
|
+
export declare class BoxCollider extends Collider<BoxColliderProps> {
|
|
30
29
|
get size(): Size;
|
|
31
30
|
set size(s: Size);
|
|
32
31
|
update(dt: any, draw: Graphics): void;
|
|
33
32
|
}
|
|
34
|
-
|
|
33
|
+
interface CircleColliderProps extends ColliderProps {
|
|
35
34
|
radius: number;
|
|
36
|
-
|
|
35
|
+
}
|
|
36
|
+
export declare class CircleCollider extends Collider<CircleColliderProps> {
|
|
37
37
|
update(dt: any, draw: Graphics): void;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
interface PolygonColliderProps extends ColliderProps {
|
|
40
|
+
points: Array<Point>;
|
|
41
|
+
}
|
|
42
|
+
export declare class PolygonCollider extends Collider<PolygonColliderProps> {
|
|
42
43
|
get points(): Point[];
|
|
43
44
|
set points(points: Point[]);
|
|
44
45
|
update(dt: any, draw: Graphics): void;
|
|
@@ -60,4 +61,5 @@ export declare class Contract {
|
|
|
60
61
|
updateState(): CollisionType;
|
|
61
62
|
test(): boolean;
|
|
62
63
|
}
|
|
64
|
+
export {};
|
|
63
65
|
//# sourceMappingURL=CollideComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollideComponent.d.ts","sourceRoot":"","sources":["../../src/collider/CollideComponent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"CollideComponent.d.ts","sourceRoot":"","sources":["../../src/collider/CollideComponent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAG1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAgBhE,UAAU,aAAa;IACrB,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAA;IAC5C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAA;IAC3C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAA;CAC5C;AAED,qBAAa,QAAQ,CAAC,CAAC,GAAG,aAAa,CAAE,SAAQ,kBAAk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AAQ,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;IAClB,iBAAiB,EAAE,OAAO,CAAA;IAC1B,eAAe,EAAE,OAAO,CAAA;IACxB,gBAAgB,EAAE,OAAO,CAAA;gBAEb,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ;IAsBpD,WAAW;IAiBX,IAAI;CAyBL"}
|
|
@@ -18,7 +18,6 @@ function cloneRect(origin) {
|
|
|
18
18
|
export class Collider extends NoRenderComponentX {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
21
|
-
this.enabled = true;
|
|
22
21
|
this._worldPoints = [];
|
|
23
22
|
this._AABB = new Rectangle(0, 0, 0, 0);
|
|
24
23
|
this._preAabb = new Rectangle(0, 0, 0, 0);
|
|
@@ -34,35 +33,20 @@ export class Collider extends NoRenderComponentX {
|
|
|
34
33
|
preAabb: this._preAabb,
|
|
35
34
|
};
|
|
36
35
|
}
|
|
37
|
-
setOnCollisionEnter(cb) {
|
|
38
|
-
const collider = this.getComponent(Collider);
|
|
39
|
-
collider.onCollisionEnter = cb;
|
|
40
|
-
}
|
|
41
|
-
setOnCollisionExit(cb) {
|
|
42
|
-
const collider = this.getComponent(Collider);
|
|
43
|
-
collider.onCollisionExit = cb;
|
|
44
|
-
}
|
|
45
|
-
setOnCollisionStay(cb) {
|
|
46
|
-
const collider = this.getComponent(Collider);
|
|
47
|
-
collider.onCollisionStay = cb;
|
|
48
|
-
}
|
|
49
36
|
}
|
|
50
37
|
export class BoxCollider extends Collider {
|
|
51
|
-
constructor(props) {
|
|
52
|
-
super(props);
|
|
53
|
-
}
|
|
54
38
|
get size() {
|
|
55
|
-
return this;
|
|
39
|
+
return this.props;
|
|
56
40
|
}
|
|
57
41
|
set size(s) {
|
|
58
|
-
this.width = s.width;
|
|
59
|
-
this.height = s.height;
|
|
42
|
+
this.props.width = s.width;
|
|
43
|
+
this.props.height = s.height;
|
|
60
44
|
}
|
|
61
45
|
update(dt, draw) {
|
|
62
46
|
if (!this.node) {
|
|
63
47
|
return;
|
|
64
48
|
}
|
|
65
|
-
const { x, y } = this.offset || v2();
|
|
49
|
+
const { x, y } = this.props.offset || v2();
|
|
66
50
|
// const hw = this.width * 0.5
|
|
67
51
|
// const hh = this.height * 0.5
|
|
68
52
|
const transform = getNodeToWorldTransformAR(this.node);
|
|
@@ -71,9 +55,9 @@ export class BoxCollider extends Collider {
|
|
|
71
55
|
const collider = this.getComponent(Collider);
|
|
72
56
|
collider._worldPoints = [
|
|
73
57
|
v2(x, y),
|
|
74
|
-
v2(x, y + this.height),
|
|
75
|
-
v2(x + this.width, y + this.height),
|
|
76
|
-
v2(x + this.width, y)
|
|
58
|
+
v2(x, y + this.props.height),
|
|
59
|
+
v2(x + this.props.width, y + this.props.height),
|
|
60
|
+
v2(x + this.props.width, y)
|
|
77
61
|
].map(p => transform.apply(p));
|
|
78
62
|
// console.log("_worldPoints", collider._worldPoints, rectTrs)
|
|
79
63
|
// collider._worldPoints = collider._worldPoints.map(p => transform.apply(p))
|
|
@@ -94,17 +78,14 @@ export class BoxCollider extends Collider {
|
|
|
94
78
|
}
|
|
95
79
|
}
|
|
96
80
|
export class CircleCollider extends Collider {
|
|
97
|
-
constructor(props) {
|
|
98
|
-
super(props);
|
|
99
|
-
}
|
|
100
81
|
update(dt, draw) {
|
|
101
82
|
if (!this.node) {
|
|
102
83
|
return;
|
|
103
84
|
}
|
|
104
85
|
const transform = getNodeToWorldTransformAR(this.node);
|
|
105
86
|
const collider = this.getComponent(Collider);
|
|
106
|
-
collider._worldRadius = this.radius * this.node.scaleX;
|
|
107
|
-
collider._worldPosition = transform.apply(this.offset);
|
|
87
|
+
collider._worldRadius = this.props.radius * this.node.scaleX;
|
|
88
|
+
collider._worldPosition = transform.apply(this.props.offset);
|
|
108
89
|
if (draw) {
|
|
109
90
|
const { x } = collider._worldPosition;
|
|
110
91
|
const y = app.screen.height - collider._worldPosition.y;
|
|
@@ -122,17 +103,13 @@ export class CircleCollider extends Collider {
|
|
|
122
103
|
}
|
|
123
104
|
}
|
|
124
105
|
export class PolygonCollider extends Collider {
|
|
125
|
-
constructor(props) {
|
|
126
|
-
super(props);
|
|
127
|
-
this._points = props.points || [];
|
|
128
|
-
}
|
|
129
106
|
get points() {
|
|
130
|
-
const { x, y } = this.offset;
|
|
131
|
-
const pointsList = this.
|
|
107
|
+
const { x, y } = this.props.offset;
|
|
108
|
+
const pointsList = this.props.points.map((p) => v2(p.x + x, p.y + y));
|
|
132
109
|
return pointsList;
|
|
133
110
|
}
|
|
134
111
|
set points(points) {
|
|
135
|
-
this.
|
|
112
|
+
this.props.points = points;
|
|
136
113
|
}
|
|
137
114
|
update(dt, draw) {
|
|
138
115
|
if (!this.node) {
|
|
@@ -104,28 +104,28 @@ export class CollideSystem {
|
|
|
104
104
|
}
|
|
105
105
|
switch (type) {
|
|
106
106
|
case CollisionType.ENTER: {
|
|
107
|
-
if (col1.onCollisionEnter) {
|
|
108
|
-
col1.onCollisionEnter(col2);
|
|
107
|
+
if (col1.props.onCollisionEnter) {
|
|
108
|
+
col1.props.onCollisionEnter(col2);
|
|
109
109
|
}
|
|
110
|
-
if (col2.onCollisionEnter) {
|
|
111
|
-
col2.onCollisionEnter(col1);
|
|
110
|
+
if (col2.props.onCollisionEnter) {
|
|
111
|
+
col2.props.onCollisionEnter(col1);
|
|
112
112
|
}
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
115
|
case CollisionType.STAY:
|
|
116
|
-
if (col1.onCollisionStay) {
|
|
117
|
-
col1.onCollisionStay(col2);
|
|
116
|
+
if (col1.props.onCollisionStay) {
|
|
117
|
+
col1.props.onCollisionStay(col2);
|
|
118
118
|
}
|
|
119
|
-
if (col2.onCollisionStay) {
|
|
120
|
-
col2.onCollisionStay(col1);
|
|
119
|
+
if (col2.props.onCollisionStay) {
|
|
120
|
+
col2.props.onCollisionStay(col1);
|
|
121
121
|
}
|
|
122
122
|
break;
|
|
123
123
|
case CollisionType.EXIT:
|
|
124
|
-
if (col1.onCollisionExit) {
|
|
125
|
-
col1.onCollisionExit(col2);
|
|
124
|
+
if (col1.props.onCollisionExit) {
|
|
125
|
+
col1.props.onCollisionExit(col2);
|
|
126
126
|
}
|
|
127
|
-
if (col2.onCollisionExit) {
|
|
128
|
-
col2.onCollisionExit(col1);
|
|
127
|
+
if (col2.props.onCollisionExit) {
|
|
128
|
+
col2.props.onCollisionExit(col1);
|
|
129
129
|
}
|
|
130
130
|
break;
|
|
131
131
|
default:
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Container } from 'pixi.js';
|
|
2
2
|
import { EnhancedComponent } from '../base';
|
|
3
3
|
import { NodeComp } from './NodeComp';
|
|
4
|
-
export declare class NoRenderComponentX<Props =
|
|
4
|
+
export declare class NoRenderComponentX<Props = {}, C extends Container = Container> extends EnhancedComponent<Props, NodeComp<C>> {
|
|
5
5
|
}
|
|
6
|
-
export declare class ComponentX<Props =
|
|
6
|
+
export declare class ComponentX<Props = {}, C extends Container = Container> extends EnhancedComponent<Props, NodeComp<C>> {
|
|
7
7
|
static hasRender: boolean;
|
|
8
8
|
render?(): this;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseComponent.d.ts","sourceRoot":"","sources":["../../src/components/BaseComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAa,MAAM,SAAS,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,qBAAa,kBAAkB,CAAC,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"BaseComponent.d.ts","sourceRoot":"","sources":["../../src/components/BaseComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAa,MAAM,SAAS,CAAA;AAEtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC,qBAAa,kBAAkB,CAAC,KAAK,GAAG,EAAE,EAAE,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;CACzH;AAED,qBAAa,UAAU,CAAC,KAAK,GAAG,EAAE,EAAE,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAChH,MAAM,CAAC,SAAS,UAAO;IACvB,MAAM,CAAC,IAAI,IAAI;CAMhB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Constructor, Entity } from 'entityx-ts';
|
|
2
2
|
import { Action, Animation } from 'pixi-action-ease';
|
|
3
3
|
import { Color, ColorSource, Container, Point } from 'pixi.js';
|
|
4
|
-
import {
|
|
4
|
+
import { ComponentType, EnhancedComponent } from '../base';
|
|
5
5
|
import { Size } from '../core/Size';
|
|
6
6
|
export type EventCallbackType = (...args: any[]) => void;
|
|
7
7
|
export interface EventMap {
|
|
@@ -10,7 +10,7 @@ export interface EventMap {
|
|
|
10
10
|
type TouchEventCallback = (target: {
|
|
11
11
|
location: Point;
|
|
12
12
|
}) => void;
|
|
13
|
-
export declare class NodeComp<C extends Container = Container>
|
|
13
|
+
export declare class NodeComp<C extends Container = Container> {
|
|
14
14
|
entity: Entity;
|
|
15
15
|
instance: C;
|
|
16
16
|
events: EventMap;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeComp.d.ts","sourceRoot":"","sources":["../../src/components/NodeComp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEhD,OAAO,EAAE,MAAM,EAAiB,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAU,MAAM,SAAS,C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S,CAAC,GAAG,EAAE,MAAM;IAKrB,cAAc;IAOd,eAAe;IAMf,gBAAgB;IAMhB,OAAO;IAaP,gBAAgB;IAMhB,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,EAAE,MAAM;IAQzC,kBAAkB;IAMlB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,GAAG;IAS1D,GAAG,CAAC,IAAI,EAAE,MAAM;IAIhB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG;IAMjC,gBAAgB,CAAC,SAAS,EAAE,iBAAiB,CAAC,EAAE,EAAE,QAAQ,CAAC;IAY3D,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;IAM1B,OAAO,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;CASjC"}
|
|
@@ -329,7 +329,7 @@ export class NodeComp {
|
|
|
329
329
|
getData(key) {
|
|
330
330
|
const data = this.getComponent(ExtraDataComp);
|
|
331
331
|
if (!data)
|
|
332
|
-
|
|
332
|
+
return console.warn('need add ExtraDataComp to Node');
|
|
333
333
|
return data.getData(key);
|
|
334
334
|
}
|
|
335
335
|
setData(key, value) {
|