@inglorious/engine 24.2.1 → 24.3.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 +9 -2
- package/package.json +4 -4
- package/types/behaviors/input/controls.d.ts +1 -1
- package/types/test.d.ts +3 -1
package/README.md
CHANGED
|
@@ -16,6 +16,14 @@ pnpm create @inglorious/game
|
|
|
16
16
|
|
|
17
17
|
This sets up a small playable game with a development server and tests, and can make it an installable PWA or an Android and iOS app with Capacitor.
|
|
18
18
|
|
|
19
|
+
To add the engine to an existing project, install the store with it:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add @inglorious/engine @inglorious/store @inglorious/renderer-2d
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The engine creates the store for you, but the store is your game's: it is a peer dependency, so the engine and your code (`fsm`, `scenes`, `patch`) share one copy.
|
|
26
|
+
|
|
19
27
|
## Features
|
|
20
28
|
|
|
21
29
|
- **Functional & Data-Oriented**: Uses a single, immutable state object as the source of truth, inspired by functional programming principles.
|
|
@@ -426,9 +434,8 @@ Because building things is fun! This project is as much an exploration of softwa
|
|
|
426
434
|
|
|
427
435
|
The core engine relies on a few key, lightweight packages:
|
|
428
436
|
|
|
429
|
-
- [mutative](https://www.npmjs.com/package/mutative): For enabling ergonomic immutable updates with structural sharing.
|
|
430
437
|
- [@inglorious/utils](https://www.npmjs.com/package/@inglorious/utils): A collection of small, pure utility functions for things like vector math and data manipulation.
|
|
431
|
-
- [@inglorious/store](https://www.npmjs.com/package/@inglorious/store): The environment-agnostic core state management library.
|
|
438
|
+
- [@inglorious/store](https://www.npmjs.com/package/@inglorious/store) (peer dependency, install it yourself): The environment-agnostic core state management library, which uses [mutative](https://www.npmjs.com/package/mutative) for ergonomic immutable updates with structural sharing.
|
|
432
439
|
|
|
433
440
|
## Quick Start Example
|
|
434
441
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/engine",
|
|
3
|
-
"version": "24.
|
|
3
|
+
"version": "24.3.0",
|
|
4
4
|
"description": "A JavaScript game engine written with global state, immutability, and pure functions in mind. Have fun(ctional programming) with it!",
|
|
5
5
|
"author": "Matteo Antony Mistretta <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,14 +41,14 @@
|
|
|
41
41
|
},
|
|
42
42
|
"sideEffects": false,
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@inglorious/
|
|
45
|
-
"@inglorious/utils": "^5.4.3"
|
|
44
|
+
"@inglorious/utils": "^5.5.0"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
47
|
+
"@inglorious/store": "^12.9.5",
|
|
48
48
|
"vitest": "^5.1.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@inglorious/eslint-config": "1.2.
|
|
51
|
+
"@inglorious/eslint-config": "1.2.2",
|
|
52
52
|
"prettier": "^3.10.1",
|
|
53
53
|
"typescript": "~7.0.2",
|
|
54
54
|
"vite": "^8.3.8",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { gamepad, GamepadEntity, gamepadsPoller } from "./gamepad"
|
|
2
2
|
import type { input, InputEntity } from "./input"
|
|
3
3
|
import type { InputMapping, keyboard, KeyboardEntity } from "./keyboard"
|
|
4
4
|
import type { pointer, PointerEntity } from "./pointer"
|
package/types/test.d.ts
CHANGED
|
@@ -30,7 +30,9 @@ export interface TestGame {
|
|
|
30
30
|
* Makes a game to drive in a test, with its sounds watched. `extendWith` adds
|
|
31
31
|
* the game's own moves, which can call the rest with `this`.
|
|
32
32
|
*/
|
|
33
|
-
export function createGame<
|
|
33
|
+
export function createGame<
|
|
34
|
+
TExtra extends Record<string, unknown> = Record<never, never>,
|
|
35
|
+
>(
|
|
34
36
|
gameConfig: GameConfig & { entities: { game: BaseEntity | EntityConfig } },
|
|
35
37
|
extendWith?: TExtra & ThisType<TestGame & TExtra>,
|
|
36
38
|
): TestGame & TExtra
|