Expand description
Input subsystem: keyboard + mouse + gamepads + touch, with held / just-pressed / just-released semantics.
Call Input::handle_window_event for every winit::event::WindowEvent and
Input::poll_gamepads once per frame before update, then Input::end_frame once
per frame after update to clear edge state.
Structs§
- Gamepad
- Per-controller state, with the same held / just-pressed / just-released model as the
keyboard. Obtain via
Input::gamepadsorInput::first_gamepad. - Gamepad
Id - Gamepad ID.
- Input
- Pointer
Mapping - Maps window positions (physical pixels) to the space the game draws in, e.g. a
virtual-resolution canvas scaled into the window:
game = (window - origin) * scale. The toolkit sets it each frame from the renderer; seeInput::set_pointer_mapping. - Touch
- One finger on a touchscreen. Positions are in the same space as
Input::mouse_pos: physical window pixels, or canvas pixels with a virtual resolution (more precisely, mapped by thePointerMappingin effect when the event arrived). Obtain viaInput::touches,Input::touches_startedorInput::touches_ended.
Enums§
- Axis
- Gamepad’s elements which state can be represented by value from -1.0 to 1.0.
- Button
- Gamepad’s elements which state can be represented by value from 0.0 to 1.0.
- Key
- Code representing the location of a physical key
- Mouse
Button