@yagejs/input 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 ADDED
@@ -0,0 +1,54 @@
1
+ # @yagejs/input
2
+
3
+ Keyboard, mouse, gamepad, and touch handling for the [YAGE](https://yage.dev) 2D game engine.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @yagejs/input
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { Engine } from "@yagejs/core";
15
+ import { InputPlugin, InputManagerKey } from "@yagejs/input";
16
+
17
+ const engine = new Engine();
18
+ engine.use(new InputPlugin({
19
+ actions: {
20
+ jump: ["Space", "KeyW"],
21
+ left: ["ArrowLeft", "KeyA"],
22
+ right: ["ArrowRight", "KeyD"],
23
+ },
24
+ }));
25
+ ```
26
+
27
+ Read input inside a component:
28
+
29
+ ```ts
30
+ class PlayerController extends Component {
31
+ private readonly input = this.service(InputManagerKey);
32
+
33
+ update(dt: number): void {
34
+ if (this.input.isActionDown("jump")) {
35
+ // jump
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ ## What's in the box
42
+
43
+ - **InputPlugin / InputManager** - unified keyboard, mouse, gamepad, touch
44
+ - **Action maps** - bind named actions to multiple keys
45
+ - **Runtime rebinding** - with conflict policies
46
+ - **Pointer events** - world-space mouse/touch with camera awareness
47
+
48
+ ## Docs
49
+
50
+ Full documentation at [yage.dev](https://yage.dev).
51
+
52
+ ## License
53
+
54
+ MIT