@yagejs/core 0.1.0
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 +55 -0
- package/dist/index.cjs +3035 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1512 -0
- package/dist/index.d.ts +1512 -0
- package/dist/index.js +2943 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @yagejs/core
|
|
2
|
+
|
|
3
|
+
ECS, math, events, and scheduling - the foundation of the [YAGE](https://yage.dev) 2D game engine.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @yagejs/core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## What's in the box
|
|
12
|
+
|
|
13
|
+
- **Engine** - the game loop and plugin host
|
|
14
|
+
- **Scene / SceneManager** - scene stack with push/pop, pause, and time scaling
|
|
15
|
+
- **Entity / Component** - ECS primitives with typed queries
|
|
16
|
+
- **Transform / Vec2** - 2D math and spatial positioning
|
|
17
|
+
- **EventBus** - typed, decoupled events with `defineEvent`
|
|
18
|
+
- **Blueprint / Trait** - composition helpers
|
|
19
|
+
- **Process / Tween / Sequence** - timers, easing, and keyframe animation
|
|
20
|
+
- **AssetManager** - async resource loading
|
|
21
|
+
- **Inspector** - snapshot introspection for tests and debug tools
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { Engine, Scene, Entity, Component, Transform, Vec2 } from "@yagejs/core";
|
|
27
|
+
|
|
28
|
+
class Player extends Entity {
|
|
29
|
+
setup() {
|
|
30
|
+
this.add(new Transform({ position: new Vec2(100, 100) }));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
class GameScene extends Scene {
|
|
35
|
+
readonly name = "game";
|
|
36
|
+
|
|
37
|
+
onEnter() {
|
|
38
|
+
this.spawn(Player);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const engine = new Engine();
|
|
43
|
+
await engine.start();
|
|
44
|
+
engine.scenes.push(new GameScene());
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`@yagejs/core` has zero runtime dependencies. On its own it's a pure ECS - add `@yagejs/renderer` to draw things, `@yagejs/physics` for collisions, `@yagejs/input` for controls, etc.
|
|
48
|
+
|
|
49
|
+
## Docs
|
|
50
|
+
|
|
51
|
+
Full documentation at [yage.dev](https://yage.dev).
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
MIT
|