@series-inc/rundot-3d-engine 0.3.0 → 0.4.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/LICENSE.txt +6 -6
- package/docs/core/Component.md +321 -321
- package/docs/core/GameObject.md +204 -204
- package/docs/core/VenusGame.md +316 -316
- package/docs/patterns/ComponentCommunication.md +337 -337
- package/docs/patterns/CreatingGameObjects.md +290 -290
- package/docs/patterns/MeshColliders.md +338 -338
- package/docs/patterns/MeshLoading.md +316 -316
- package/docs/physics/Colliders.md +249 -249
- package/docs/physics/PhysicsSystem.md +151 -151
- package/docs/physics/RigidBodyComponent.md +201 -201
- package/docs/rendering/AssetManager.md +308 -308
- package/docs/rendering/InstancedRenderer.md +286 -286
- package/docs/rendering/MeshRenderer.md +286 -286
- package/docs/rendering/SkeletalRenderer.md +308 -308
- package/docs/systems/AnimationSystem.md +75 -75
- package/docs/systems/AudioSystem.md +79 -79
- package/docs/systems/InputManager.md +101 -101
- package/docs/systems/LightingSystem.md +101 -101
- package/docs/systems/ParticleSystem.md +44 -44
- package/docs/systems/PrefabSystem.md +60 -60
- package/docs/systems/StowKitSystem.md +77 -77
- package/docs/systems/TweenSystem.md +132 -132
- package/docs/systems/UISystem.md +73 -73
- package/package.json +1 -1
- package/scripts/postinstall.mjs +63 -51
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
# AnimationSystem
|
|
2
|
-
|
|
3
|
-
Advanced animation system with state machines, blending, retargeting, and frustum culling for skeletal characters.
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { AnimationControllerComponent } from "@series-ai/rundot-3d-engine/systems"
|
|
9
|
-
|
|
10
|
-
// Add to character with SkeletalRenderer
|
|
11
|
-
const character = new GameObject("Character")
|
|
12
|
-
character.addComponent(new SkeletalRenderer("Character/player.fbx"))
|
|
13
|
-
|
|
14
|
-
const animController = new AnimationControllerComponent()
|
|
15
|
-
character.addComponent(animController)
|
|
16
|
-
|
|
17
|
-
// Add animation states
|
|
18
|
-
animController.addState("idle", "Animations/idle.fbx")
|
|
19
|
-
animController.addState("walk", "Animations/walk.fbx")
|
|
20
|
-
animController.addState("run", "Animations/run.fbx")
|
|
21
|
-
|
|
22
|
-
// Play animation
|
|
23
|
-
animController.setState("idle")
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Common Use Cases
|
|
27
|
-
|
|
28
|
-
### State Machine
|
|
29
|
-
|
|
30
|
-
```typescript
|
|
31
|
-
class CharacterController extends Component {
|
|
32
|
-
private animController?: AnimationControllerComponent
|
|
33
|
-
|
|
34
|
-
protected onCreate(): void {
|
|
35
|
-
this.animController = this.getComponent(AnimationControllerComponent)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
public update(deltaTime: number): void {
|
|
39
|
-
const speed = this.getMovementSpeed()
|
|
40
|
-
|
|
41
|
-
if (speed === 0) {
|
|
42
|
-
this.animController?.setState("idle")
|
|
43
|
-
} else if (speed < 5) {
|
|
44
|
-
this.animController?.setState("walk")
|
|
45
|
-
} else {
|
|
46
|
-
this.animController?.setState("run")
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Animation Culling
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
// Enable frustum culling to skip animations for off-screen characters
|
|
56
|
-
VenusGame.setAnimationCullingCamera(camera, 1.2)
|
|
57
|
-
|
|
58
|
-
// Or distance culling
|
|
59
|
-
const culling = VenusGame.getAnimationCulling()
|
|
60
|
-
culling.setDistanceCullingEnabled(true)
|
|
61
|
-
culling.setMaxDistance(50) // Units
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## API Overview
|
|
65
|
-
|
|
66
|
-
- `addState(name, animationPath)` - Register animation state
|
|
67
|
-
- `setState(name)` - Switch to animation
|
|
68
|
-
- `setBlendDuration(seconds)` - Set transition time
|
|
69
|
-
- `getState(): string` - Get current state
|
|
70
|
-
|
|
71
|
-
## Related Systems
|
|
72
|
-
|
|
73
|
-
- [SkeletalRenderer](../rendering/SkeletalRenderer.md) - Animated character meshes
|
|
74
|
-
- [AssetManager](../rendering/AssetManager.md) - Load animation clips
|
|
75
|
-
|
|
1
|
+
# AnimationSystem
|
|
2
|
+
|
|
3
|
+
Advanced animation system with state machines, blending, retargeting, and frustum culling for skeletal characters.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { AnimationControllerComponent } from "@series-ai/rundot-3d-engine/systems"
|
|
9
|
+
|
|
10
|
+
// Add to character with SkeletalRenderer
|
|
11
|
+
const character = new GameObject("Character")
|
|
12
|
+
character.addComponent(new SkeletalRenderer("Character/player.fbx"))
|
|
13
|
+
|
|
14
|
+
const animController = new AnimationControllerComponent()
|
|
15
|
+
character.addComponent(animController)
|
|
16
|
+
|
|
17
|
+
// Add animation states
|
|
18
|
+
animController.addState("idle", "Animations/idle.fbx")
|
|
19
|
+
animController.addState("walk", "Animations/walk.fbx")
|
|
20
|
+
animController.addState("run", "Animations/run.fbx")
|
|
21
|
+
|
|
22
|
+
// Play animation
|
|
23
|
+
animController.setState("idle")
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Common Use Cases
|
|
27
|
+
|
|
28
|
+
### State Machine
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
class CharacterController extends Component {
|
|
32
|
+
private animController?: AnimationControllerComponent
|
|
33
|
+
|
|
34
|
+
protected onCreate(): void {
|
|
35
|
+
this.animController = this.getComponent(AnimationControllerComponent)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public update(deltaTime: number): void {
|
|
39
|
+
const speed = this.getMovementSpeed()
|
|
40
|
+
|
|
41
|
+
if (speed === 0) {
|
|
42
|
+
this.animController?.setState("idle")
|
|
43
|
+
} else if (speed < 5) {
|
|
44
|
+
this.animController?.setState("walk")
|
|
45
|
+
} else {
|
|
46
|
+
this.animController?.setState("run")
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Animation Culling
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// Enable frustum culling to skip animations for off-screen characters
|
|
56
|
+
VenusGame.setAnimationCullingCamera(camera, 1.2)
|
|
57
|
+
|
|
58
|
+
// Or distance culling
|
|
59
|
+
const culling = VenusGame.getAnimationCulling()
|
|
60
|
+
culling.setDistanceCullingEnabled(true)
|
|
61
|
+
culling.setMaxDistance(50) // Units
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## API Overview
|
|
65
|
+
|
|
66
|
+
- `addState(name, animationPath)` - Register animation state
|
|
67
|
+
- `setState(name)` - Switch to animation
|
|
68
|
+
- `setBlendDuration(seconds)` - Set transition time
|
|
69
|
+
- `getState(): string` - Get current state
|
|
70
|
+
|
|
71
|
+
## Related Systems
|
|
72
|
+
|
|
73
|
+
- [SkeletalRenderer](../rendering/SkeletalRenderer.md) - Animated character meshes
|
|
74
|
+
- [AssetManager](../rendering/AssetManager.md) - Load animation clips
|
|
75
|
+
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
# AudioSystem
|
|
2
|
-
|
|
3
|
-
2D and 3D audio playback with music management and volume control.
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { AudioSystem, Audio2D } from "@series-ai/rundot-3d-engine/systems"
|
|
9
|
-
|
|
10
|
-
// Play 2D sound effect
|
|
11
|
-
const sfx = new Audio2D("SFX/click.ogg")
|
|
12
|
-
sfx.play()
|
|
13
|
-
|
|
14
|
-
// Play music
|
|
15
|
-
AudioSystem.playMusic("Music/track_01.ogg", { loop: true, volume: 0.5 })
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## Common Use Cases
|
|
19
|
-
|
|
20
|
-
### Sound Effects
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
class Button extends Component {
|
|
24
|
-
private clickSound?: Audio2D
|
|
25
|
-
|
|
26
|
-
protected onCreate(): void {
|
|
27
|
-
this.clickSound = new Audio2D("SFX/click.ogg")
|
|
28
|
-
this.gameObject.addComponent(this.clickSound)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
private onClick(): void {
|
|
32
|
-
this.clickSound?.play()
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Background Music
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
class MyGame extends VenusGame {
|
|
41
|
-
protected async onStart(): Promise<void> {
|
|
42
|
-
// Play looping music
|
|
43
|
-
AudioSystem.playMusic("Music/track_01.ogg", {
|
|
44
|
-
loop: true,
|
|
45
|
-
volume: 0.7,
|
|
46
|
-
fadeInDuration: 2.0
|
|
47
|
-
})
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### Volume Control
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
// Master volume
|
|
56
|
-
AudioSystem.mainListener?.setMasterVolume(0.5)
|
|
57
|
-
|
|
58
|
-
// Individual sound volume
|
|
59
|
-
sfx.setVolume(0.8)
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## API Overview
|
|
63
|
-
|
|
64
|
-
### AudioSystem
|
|
65
|
-
- `playMusic(path, options?)` - Play background music
|
|
66
|
-
- `stopMusic(fadeOutDuration?)` - Stop music
|
|
67
|
-
- `mainListener` - Global audio listener
|
|
68
|
-
|
|
69
|
-
### Audio2D Component
|
|
70
|
-
- `play()` - Play sound
|
|
71
|
-
- `stop()` - Stop sound
|
|
72
|
-
- `setVolume(volume)` - Set volume (0-1)
|
|
73
|
-
- `setLoop(loop)` - Enable/disable looping
|
|
74
|
-
|
|
75
|
-
## Related Systems
|
|
76
|
-
|
|
77
|
-
- [VenusGame](../core/VenusGame.md) - Creates audio listener
|
|
78
|
-
- [Component](../core/Component.md) - Audio2D is a component
|
|
79
|
-
|
|
1
|
+
# AudioSystem
|
|
2
|
+
|
|
3
|
+
2D and 3D audio playback with music management and volume control.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { AudioSystem, Audio2D } from "@series-ai/rundot-3d-engine/systems"
|
|
9
|
+
|
|
10
|
+
// Play 2D sound effect
|
|
11
|
+
const sfx = new Audio2D("SFX/click.ogg")
|
|
12
|
+
sfx.play()
|
|
13
|
+
|
|
14
|
+
// Play music
|
|
15
|
+
AudioSystem.playMusic("Music/track_01.ogg", { loop: true, volume: 0.5 })
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Common Use Cases
|
|
19
|
+
|
|
20
|
+
### Sound Effects
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
class Button extends Component {
|
|
24
|
+
private clickSound?: Audio2D
|
|
25
|
+
|
|
26
|
+
protected onCreate(): void {
|
|
27
|
+
this.clickSound = new Audio2D("SFX/click.ogg")
|
|
28
|
+
this.gameObject.addComponent(this.clickSound)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private onClick(): void {
|
|
32
|
+
this.clickSound?.play()
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Background Music
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
class MyGame extends VenusGame {
|
|
41
|
+
protected async onStart(): Promise<void> {
|
|
42
|
+
// Play looping music
|
|
43
|
+
AudioSystem.playMusic("Music/track_01.ogg", {
|
|
44
|
+
loop: true,
|
|
45
|
+
volume: 0.7,
|
|
46
|
+
fadeInDuration: 2.0
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Volume Control
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
// Master volume
|
|
56
|
+
AudioSystem.mainListener?.setMasterVolume(0.5)
|
|
57
|
+
|
|
58
|
+
// Individual sound volume
|
|
59
|
+
sfx.setVolume(0.8)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## API Overview
|
|
63
|
+
|
|
64
|
+
### AudioSystem
|
|
65
|
+
- `playMusic(path, options?)` - Play background music
|
|
66
|
+
- `stopMusic(fadeOutDuration?)` - Stop music
|
|
67
|
+
- `mainListener` - Global audio listener
|
|
68
|
+
|
|
69
|
+
### Audio2D Component
|
|
70
|
+
- `play()` - Play sound
|
|
71
|
+
- `stop()` - Stop sound
|
|
72
|
+
- `setVolume(volume)` - Set volume (0-1)
|
|
73
|
+
- `setLoop(loop)` - Enable/disable looping
|
|
74
|
+
|
|
75
|
+
## Related Systems
|
|
76
|
+
|
|
77
|
+
- [VenusGame](../core/VenusGame.md) - Creates audio listener
|
|
78
|
+
- [Component](../core/Component.md) - Audio2D is a component
|
|
79
|
+
|
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
# InputManager
|
|
2
|
-
|
|
3
|
-
Cross-platform input system for keyboard, mouse, and touch with mobile support.
|
|
4
|
-
|
|
5
|
-
## Quick Start
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
import { InputManager } from "@series-ai/rundot-3d-engine/systems"
|
|
9
|
-
|
|
10
|
-
// Check keyboard input
|
|
11
|
-
if (InputManager.isKeyDown("w")) {
|
|
12
|
-
player.moveForward()
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Check mouse button
|
|
16
|
-
if (InputManager.isMouseButtonDown(0)) { // Left click
|
|
17
|
-
fireWeapon()
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Get mouse position
|
|
21
|
-
const mousePos = InputManager.getMousePosition()
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Common Use Cases
|
|
25
|
-
|
|
26
|
-
### Keyboard Input
|
|
27
|
-
|
|
28
|
-
```typescript
|
|
29
|
-
class PlayerController extends Component {
|
|
30
|
-
public update(deltaTime: number): void {
|
|
31
|
-
const speed = 5
|
|
32
|
-
|
|
33
|
-
if (InputManager.isKeyDown("w")) {
|
|
34
|
-
this.gameObject.position.z -= speed * deltaTime
|
|
35
|
-
}
|
|
36
|
-
if (InputManager.isKeyDown("s")) {
|
|
37
|
-
this.gameObject.position.z += speed * deltaTime
|
|
38
|
-
}
|
|
39
|
-
if (InputManager.isKeyDown("a")) {
|
|
40
|
-
this.gameObject.position.x -= speed * deltaTime
|
|
41
|
-
}
|
|
42
|
-
if (InputManager.isKeyDown("d")) {
|
|
43
|
-
this.gameObject.position.x += speed * deltaTime
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### Mouse Input
|
|
50
|
-
|
|
51
|
-
```typescript
|
|
52
|
-
// Mouse buttons
|
|
53
|
-
if (InputManager.isMouseButtonDown(0)) { // Left
|
|
54
|
-
console.log("Left click")
|
|
55
|
-
}
|
|
56
|
-
if (InputManager.isMouseButtonDown(2)) { // Right
|
|
57
|
-
console.log("Right click")
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Mouse position (screen coordinates)
|
|
61
|
-
const pos = InputManager.getMousePosition()
|
|
62
|
-
console.log(`Mouse at ${pos.x}, ${pos.y}`)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Touch Input (Mobile)
|
|
66
|
-
|
|
67
|
-
```typescript
|
|
68
|
-
// Touch is automatically mapped to mouse on mobile
|
|
69
|
-
// isMouseButtonDown(0) works for taps
|
|
70
|
-
// getMousePosition() returns touch position
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## API Overview
|
|
74
|
-
|
|
75
|
-
### Keyboard
|
|
76
|
-
- `isKeyDown(key: string): boolean` - Check if key is pressed
|
|
77
|
-
- `isKeyPressed(key: string): boolean` - Check if key was just pressed this frame
|
|
78
|
-
- `isKeyReleased(key: string): boolean` - Check if key was just released
|
|
79
|
-
|
|
80
|
-
### Mouse
|
|
81
|
-
- `isMouseButtonDown(button: number): boolean` - Check mouse button (0=left, 1=middle, 2=right)
|
|
82
|
-
- `getMousePosition(): {x: number, y: number}` - Get mouse/touch position
|
|
83
|
-
- `getMouseDelta(): {x: number, y: number}` - Get mouse movement since last frame
|
|
84
|
-
|
|
85
|
-
### System
|
|
86
|
-
- `initialize()` - Initialize input (called by VenusGame)
|
|
87
|
-
- `update()` - Update input state (automatic)
|
|
88
|
-
|
|
89
|
-
## Key Codes
|
|
90
|
-
|
|
91
|
-
Use standard keyboard keys:
|
|
92
|
-
- Letters: `"a"`, `"b"`, `"w"`, etc.
|
|
93
|
-
- Numbers: `"1"`, `"2"`, etc.
|
|
94
|
-
- Special: `"Space"`, `"Enter"`, `"Shift"`, `"Control"`, `"Alt"`
|
|
95
|
-
- Arrows: `"ArrowUp"`, `"ArrowDown"`, `"ArrowLeft"`, `"ArrowRight"`
|
|
96
|
-
|
|
97
|
-
## Related Systems
|
|
98
|
-
|
|
99
|
-
- [VenusGame](../core/VenusGame.md) - Initializes InputManager
|
|
100
|
-
- [Component](../core/Component.md) - Use input in update()
|
|
101
|
-
|
|
1
|
+
# InputManager
|
|
2
|
+
|
|
3
|
+
Cross-platform input system for keyboard, mouse, and touch with mobile support.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
import { InputManager } from "@series-ai/rundot-3d-engine/systems"
|
|
9
|
+
|
|
10
|
+
// Check keyboard input
|
|
11
|
+
if (InputManager.isKeyDown("w")) {
|
|
12
|
+
player.moveForward()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Check mouse button
|
|
16
|
+
if (InputManager.isMouseButtonDown(0)) { // Left click
|
|
17
|
+
fireWeapon()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Get mouse position
|
|
21
|
+
const mousePos = InputManager.getMousePosition()
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Common Use Cases
|
|
25
|
+
|
|
26
|
+
### Keyboard Input
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
class PlayerController extends Component {
|
|
30
|
+
public update(deltaTime: number): void {
|
|
31
|
+
const speed = 5
|
|
32
|
+
|
|
33
|
+
if (InputManager.isKeyDown("w")) {
|
|
34
|
+
this.gameObject.position.z -= speed * deltaTime
|
|
35
|
+
}
|
|
36
|
+
if (InputManager.isKeyDown("s")) {
|
|
37
|
+
this.gameObject.position.z += speed * deltaTime
|
|
38
|
+
}
|
|
39
|
+
if (InputManager.isKeyDown("a")) {
|
|
40
|
+
this.gameObject.position.x -= speed * deltaTime
|
|
41
|
+
}
|
|
42
|
+
if (InputManager.isKeyDown("d")) {
|
|
43
|
+
this.gameObject.position.x += speed * deltaTime
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Mouse Input
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
// Mouse buttons
|
|
53
|
+
if (InputManager.isMouseButtonDown(0)) { // Left
|
|
54
|
+
console.log("Left click")
|
|
55
|
+
}
|
|
56
|
+
if (InputManager.isMouseButtonDown(2)) { // Right
|
|
57
|
+
console.log("Right click")
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Mouse position (screen coordinates)
|
|
61
|
+
const pos = InputManager.getMousePosition()
|
|
62
|
+
console.log(`Mouse at ${pos.x}, ${pos.y}`)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Touch Input (Mobile)
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
// Touch is automatically mapped to mouse on mobile
|
|
69
|
+
// isMouseButtonDown(0) works for taps
|
|
70
|
+
// getMousePosition() returns touch position
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## API Overview
|
|
74
|
+
|
|
75
|
+
### Keyboard
|
|
76
|
+
- `isKeyDown(key: string): boolean` - Check if key is pressed
|
|
77
|
+
- `isKeyPressed(key: string): boolean` - Check if key was just pressed this frame
|
|
78
|
+
- `isKeyReleased(key: string): boolean` - Check if key was just released
|
|
79
|
+
|
|
80
|
+
### Mouse
|
|
81
|
+
- `isMouseButtonDown(button: number): boolean` - Check mouse button (0=left, 1=middle, 2=right)
|
|
82
|
+
- `getMousePosition(): {x: number, y: number}` - Get mouse/touch position
|
|
83
|
+
- `getMouseDelta(): {x: number, y: number}` - Get mouse movement since last frame
|
|
84
|
+
|
|
85
|
+
### System
|
|
86
|
+
- `initialize()` - Initialize input (called by VenusGame)
|
|
87
|
+
- `update()` - Update input state (automatic)
|
|
88
|
+
|
|
89
|
+
## Key Codes
|
|
90
|
+
|
|
91
|
+
Use standard keyboard keys:
|
|
92
|
+
- Letters: `"a"`, `"b"`, `"w"`, etc.
|
|
93
|
+
- Numbers: `"1"`, `"2"`, etc.
|
|
94
|
+
- Special: `"Space"`, `"Enter"`, `"Shift"`, `"Control"`, `"Alt"`
|
|
95
|
+
- Arrows: `"ArrowUp"`, `"ArrowDown"`, `"ArrowLeft"`, `"ArrowRight"`
|
|
96
|
+
|
|
97
|
+
## Related Systems
|
|
98
|
+
|
|
99
|
+
- [VenusGame](../core/VenusGame.md) - Initializes InputManager
|
|
100
|
+
- [Component](../core/Component.md) - Use input in update()
|
|
101
|
+
|