Skip to main content

euv_engine/input/
type.rs

1use super::*;
2
3/// A set of keyboard key code strings currently in a given state.
4pub type KeyStateSet = HashSet<String>;
5
6/// A map from touch identifier to touch position.
7pub type TouchPointMap = HashMap<i32, Vector2D>;
8
9/// A shared, single-threaded cell holding the engine's [`InputState`].
10///
11/// Registered DOM event listeners clone this `Rc` to keep the state alive
12/// for the lifetime of the document, while game code reads the same cell
13/// through `EngineHandle::try_get_input_cell`.
14pub type InputStateCell = Rc<EngineCell<InputState>>;
15
16/// A set of gamepad button indices in a single frame edge state.
17pub type GamepadButtonSet = HashSet<u32>;
18
19/// A set of gamepad indices in a single frame edge state.
20pub type GamepadIndexSet = HashSet<u32>;
21
22/// The states of every gamepad the manager has ever observed, keyed by the
23/// browser-assigned gamepad index.
24pub type GamepadStateMap = HashMap<u32, GamepadState>;
25
26/// A shared, single-threaded cell holding a [`GamepadManager`].
27///
28/// `gamepadconnected` / `gamepaddisconnected` listeners own a clone of this
29/// `Rc` for the lifetime of the document, so a device that appears between
30/// two polls is recorded without waiting for the next frame.
31pub type GamepadManagerCell = Rc<EngineCell<GamepadManager>>;