@skewedaspect/sage 0.10.0-rc.4 → 0.10.0-rc.6

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.
@@ -27,6 +27,8 @@ export interface PhysicsBodyState {
27
27
  velocity: Vector3State;
28
28
  /** Radians per second. */
29
29
  angularVelocity: Vector3State;
30
+ /** Whether the body is out of the physics world (design/physics.md#a-suspended-body). */
31
+ suspended: boolean;
30
32
  }
31
33
  export declare class HavokPhysicsBodyBehavior extends Behavior<PhysicsBodyState, object, NodeEntity> implements NodeBehaviorHooks {
32
34
  #private;
@@ -0,0 +1,3 @@
1
+ import { DeviceType } from "./binding.js";
2
+ export type InputScheme = 'keyboard-mouse' | 'gamepad';
3
+ export declare function schemeOf(deviceType: DeviceType): InputScheme;
@@ -3,12 +3,14 @@ import { Disposable } from "../interfaces/lifecycle.js";
3
3
  import { Binding, BindingDefinition, DeviceType } from "../input/binding.js";
4
4
  import { InputCapture } from "../input/inputCapture.js";
5
5
  import { GamepadState, KeyboardState, MouseState } from "../input/deviceState.js";
6
+ import { InputScheme } from "../input/scheme.js";
6
7
  import { ActionContextRegistry } from "../input/actionContext.js";
7
8
  import { ActionRegistry } from "../input/actionRegistry.js";
8
9
  import { LoggingUtility } from "../utils/logger.js";
9
10
  declare module '@skewedaspect/sage-core' {
10
11
  interface EventMap {
11
12
  'input:deviceChanged': DeviceChangedPayload;
13
+ 'input:schemeChanged': SchemeChangedPayload;
12
14
  }
13
15
  }
14
16
  export interface DeviceChangedPayload {
@@ -16,6 +18,11 @@ export interface DeviceChangedPayload {
16
18
  /** Undefined for the first deliberate input of a session, which replaces no device type. */
17
19
  previousDeviceType: DeviceType | undefined;
18
20
  }
21
+ export interface SchemeChangedPayload {
22
+ scheme: InputScheme;
23
+ /** Undefined for the first deliberate input of a session, which replaces no scheme. */
24
+ previousScheme: InputScheme | undefined;
25
+ }
19
26
  export declare const ROUTING_LOOP_SENDER_ID = "sage-input";
20
27
  export declare class InputManager implements Disposable {
21
28
  #private;
@@ -23,13 +30,14 @@ export declare class InputManager implements Disposable {
23
30
  readonly contexts: ActionContextRegistry;
24
31
  constructor(logger?: LoggingUtility);
25
32
  get lastActiveDeviceType(): DeviceType | undefined;
33
+ get activeScheme(): InputScheme | undefined;
26
34
  deviceState(type: 'keyboard', index: number): KeyboardState;
27
35
  deviceState(type: 'mouse', index: number): MouseState;
28
36
  deviceState(type: 'gamepad', index: number): GamepadState;
29
37
  deviceState(type: DeviceType, index: number): KeyboardState | MouseState | GamepadState;
30
38
  bind(definition: BindingDefinition): Binding<unknown>;
31
39
  registerCapture(capture: InputCapture): Unsubscribe;
32
- getBindingsForAction(action: string, deviceType?: DeviceType, context?: string): readonly Binding<unknown>[];
40
+ getBindingsForAction(action: string, deviceTypeOrScheme?: DeviceType | InputScheme, context?: string): readonly Binding<unknown>[];
33
41
  routeCapturedInput(context: GameSimulationView): void;
34
42
  dispose(): Promise<void>;
35
43
  }
package/dist/sage.d.ts CHANGED
@@ -53,6 +53,8 @@ export type { CharacterControllerState, StanceConfig } from "./behaviors/charact
53
53
  export { ActionRegistry } from "./input/actionRegistry.js";
54
54
  export { ActionContextRegistry } from "./input/actionContext.js";
55
55
  export type { Binding, BindingDefinition, BindingFire, BindingInput, BindingKind, DeviceID, DeviceType, } from "./input/binding.js";
56
+ export { schemeOf } from "./input/scheme.js";
57
+ export type { InputScheme } from "./input/scheme.js";
56
58
  export type { DeviceReader } from "./input/deviceReader.js";
57
59
  export type { GamepadState, KeyboardState, MouseState } from "./input/deviceState.js";
58
60
  export { KeyboardReader } from "./input/deviceReaders/keyboard.js";
@@ -78,7 +80,7 @@ export type { Configuration, ContextDefinition } from "./input/configuration.js"
78
80
  export type { Action, AnalogAction, DigitalAction } from '@skewedaspect/sage-core';
79
81
  export type { FrameCallback } from "./managers/game.js";
80
82
  export { InputManager, ROUTING_LOOP_SENDER_ID } from "./managers/input.js";
81
- export type { DeviceChangedPayload } from "./managers/input.js";
83
+ export type { DeviceChangedPayload, SchemeChangedPayload } from "./managers/input.js";
82
84
  export type { TransitionOptions } from "./managers/level.js";
83
85
  export { AudioManager } from "./managers/audio.js";
84
86
  export { ColliderDebugManager } from "./managers/colliderDebug.js";