Skip to content

stdlib/inputView source ↗

input

41 items · generated by scribe fromstdlib/input.fd· synced 2026-11-15

stdlib/input41 items

Contents

KEY_UNKNOWN:

pub const KEY_UNKNOWN: i64 = 0; pub const KEY_SPACE: i64 = 32; pub const KEY_APOSTROPHE: i64 = 39; pub const KEY_COMMA: i64 = 44; pub const KEY_MINUS: i64 = 45; pub const KEY_PERIOD: i64 = 46; pub const KEY_SLASH: i64 = 47; pub const KEY_0: i64 = 48; pub const KEY_1: i64 = 49; pub const KEY_2: i64 = 50; pub const KEY_3: i64 = 51; pub const KEY_4: i64 = 52; pub const KEY_5: i64 = 53; pub const KEY_6: i64 = 54; pub const KEY_7: i64 = 55; pub const KEY_8: i64 = 56; pub const KEY_9: i64 = 57; pub const KEY_SEMICOLON: i64 = 59; pub const KEY_EQUAL: i64 = 61; pub const KEY_A: i64 = 65; pub const KEY_B: i64 = 66; pub const KEY_C: i64 = 67; pub const KEY_D: i64 = 68; pub const KEY_E: i64 = 69; pub const KEY_F: i64 = 70; pub const KEY_G: i64 = 71; pub const KEY_H: i64 = 72; pub const KEY_I: i64 = 73; pub const KEY_J: i64 = 74; pub const KEY_K: i64 = 75; pub const KEY_L: i64 = 76; pub const KEY_M: i64 = 77; pub const KEY_N: i64 = 78; pub const KEY_O: i64 = 79; pub const KEY_P: i64 = 80; pub const KEY_Q: i64 = 81; pub const KEY_R: i64 = 82; pub const KEY_S: i64 = 83; pub const KEY_T: i64 = 84; pub const KEY_U: i64 = 85; pub const KEY_V: i64 = 86; pub const KEY_W: i64 = 87; pub const KEY_X: i64 = 88; pub const KEY_Y: i64 = 89; pub const KEY_Z: i64 = 90; pub const KEY_LEFT_BRACKET: i64 = 91; pub const KEY_BACKSLASH: i64 = 92; pub const KEY_RIGHT_BRACKET: i64 = 93; pub const KEY_BACKTICK: i64 = 96; pub const KEY_ESCAPE: i64 = 256; pub const KEY_ENTER: i64 = 257; pub const KEY_TAB: i64 = 258; pub const KEY_BACKSPACE: i64 = 259; pub const KEY_INSERT: i64 = 260; pub const KEY_DELETE: i64 = 261; pub const KEY_RIGHT: i64 = 262; pub const KEY_LEFT: i64 = 263; pub const KEY_DOWN: i64 = 264; pub const KEY_UP: i64 = 265; pub const KEY_PAGE_UP: i64 = 266; pub const KEY_PAGE_DOWN: i64 = 267; pub const KEY_HOME: i64 = 268; pub const KEY_END: i64 = 269; pub const KEY_CAPS_LOCK: i64 = 280; pub const KEY_SCROLL_LOCK: i64 = 281; pub const KEY_NUM_LOCK: i64 = 282; pub const KEY_PRINT_SCREEN: i64 = 283; pub const KEY_PAUSE: i64 = 284; pub const KEY_F1: i64 = 290; pub const KEY_F2: i64 = 291; pub const KEY_F3: i64 = 292; pub const KEY_F4: i64 = 293; pub const KEY_F5: i64 = 294; pub const KEY_F6: i64 = 295; pub const KEY_F7: i64 = 296; pub const KEY_F8: i64 = 297; pub const KEY_F9: i64 = 298; pub const KEY_F10: i64 = 299; pub const KEY_F11: i64 = 300; pub const KEY_F12: i64 = 301; pub const KEY_LEFT_SHIFT: i64 = 340; pub const KEY_LEFT_CONTROL: i64 = 341; pub const KEY_LEFT_ALT: i64 = 342; pub const KEY_LEFT_SUPER: i64 = 343; pub const KEY_RIGHT_SHIFT: i64 = 344; pub const KEY_RIGHT_CONTROL: i64 = 345; pub const KEY_RIGHT_ALT: i64 = 346; pub const KEY_RIGHT_SUPER: i64 = 347;

Defined at line 25


MOUSE_LEFT:

pub const MOUSE_LEFT: i64 = 0; pub const MOUSE_RIGHT: i64 = 1; pub const MOUSE_MIDDLE: i64 = 2; pub const MOUSE_X1: i64 = 3; pub const MOUSE_X2: i64 = 4;

Defined at line 28


GAMEPAD_A:

pub const GAMEPAD_A: i64 = 0; pub const GAMEPAD_B: i64 = 1; pub const GAMEPAD_X: i64 = 2; pub const GAMEPAD_Y: i64 = 3; pub const GAMEPAD_LEFT_BUMPER: i64 = 4; pub const GAMEPAD_RIGHT_BUMPER: i64 = 5; pub const GAMEPAD_BACK: i64 = 6; pub const GAMEPAD_START: i64 = 7; pub const GAMEPAD_GUIDE: i64 = 8; pub const GAMEPAD_LEFT_THUMB: i64 = 9; pub const GAMEPAD_RIGHT_THUMB: i64 = 10; pub const GAMEPAD_DPAD_UP: i64 = 11; pub const GAMEPAD_DPAD_RIGHT: i64 = 12; pub const GAMEPAD_DPAD_DOWN: i64 = 13; pub const GAMEPAD_DPAD_LEFT: i64 = 14;

Defined at line 31


InputState

pub struct InputState {

Fields:

NameType
key_currentVec<i64>
key_previousVec<i64>
mouse_xi64
mouse_yi64
mouse_delta_xi64
mouse_delta_yi64
mouse_currentVec<i64>
mouse_previousVec<i64>
mouse_wheeli64
gamepad_connectedbool
gamepad_currentVec<i64>
gamepad_previousVec<i64>
gamepad_left_xf64
gamepad_left_yf64
gamepad_right_xf64
gamepad_right_yf64
gamepad_left_triggerf64
gamepad_right_triggerf64

Defined at line 40


input_init

Initialize the input system.

pub fn input_init() -> void {

Returns: void

Defined at line 83


input_create

Create a new input state tracker.

pub fn input_create() -> InputState {

Returns: InputState

Defined at line 88


input_update

Update the input state. Call this once per frame before querying input. Copies current state to previous, then polls the platform for new state.

pub fn input_update(state: & mut InputState) -> void {

Parameters:

  • state: & mut InputState

Returns: void

Defined at line 125


input_key_held

Check if a key is currently held down.

pub fn input_key_held(state: InputState, key: i64) -> bool {

Parameters:

  • state: InputState
  • key: i64

Returns: bool

Defined at line 161


input_key_pressed

Check if a key was just pressed this frame (not held from previous frame).

pub fn input_key_pressed(state: InputState, key: i64) -> bool {

Parameters:

  • state: InputState
  • key: i64

Returns: bool

Defined at line 169


input_key_released

Check if a key was just released this frame.

pub fn input_key_released(state: InputState, key: i64) -> bool {

Parameters:

  • state: InputState
  • key: i64

Returns: bool

Defined at line 177


input_set_key

Set a key state (for testing or platform integration).

pub fn input_set_key(state: & mut InputState, key: i64, held: bool) -> void {

Parameters:

  • state: & mut InputState
  • key: i64
  • held: bool

Returns: void

Defined at line 185


input_mouse_x

Get mouse X position.

pub fn input_mouse_x(state: InputState) -> i64 {

Parameters:

  • state: InputState

Returns: i64

Defined at line 199


input_mouse_y

Get mouse Y position.

pub fn input_mouse_y(state: InputState) -> i64 {

Parameters:

  • state: InputState

Returns: i64

Defined at line 204


input_mouse_delta

Get mouse movement delta (change since last frame).

pub fn input_mouse_delta(state: InputState) -> (i64, i64) {

Parameters:

  • state: InputState

Returns: (i64, i64)

Defined at line 209


input_mouse_wheel

Get mouse wheel scroll delta.

pub fn input_mouse_wheel(state: InputState) -> i64 {

Parameters:

  • state: InputState

Returns: i64

Defined at line 214


input_mouse_held

Check if a mouse button is held.

pub fn input_mouse_held(state: InputState, button: i64) -> bool {

Parameters:

  • state: InputState
  • button: i64

Returns: bool

Defined at line 219


input_mouse_pressed

Check if a mouse button was just pressed this frame.

pub fn input_mouse_pressed(state: InputState, button: i64) -> bool {

Parameters:

  • state: InputState
  • button: i64

Returns: bool

Defined at line 227


input_mouse_released

Check if a mouse button was just released this frame.

pub fn input_mouse_released(state: InputState, button: i64) -> bool {

Parameters:

  • state: InputState
  • button: i64

Returns: bool

Defined at line 235


input_set_mouse_pos

Set mouse position (for platform integration).

pub fn input_set_mouse_pos(state: & mut InputState, x: i64, y: i64) -> void {

Parameters:

  • state: & mut InputState
  • x: i64
  • y: i64

Returns: void

Defined at line 243


input_set_mouse_button

Set mouse button state (for platform integration).

pub fn input_set_mouse_button(state: & mut InputState, button: i64, held: bool) -> void {

Parameters:

  • state: & mut InputState
  • button: i64
  • held: bool

Returns: void

Defined at line 251


input_set_mouse_wheel

Set mouse wheel delta (for platform integration).

pub fn input_set_mouse_wheel(state: & mut InputState, delta: i64) -> void {

Parameters:

  • state: & mut InputState
  • delta: i64

Returns: void

Defined at line 263


input_gamepad_connected

Check if a gamepad is connected.

pub fn input_gamepad_connected(state: InputState) -> bool {

Parameters:

  • state: InputState

Returns: bool

Defined at line 270


input_gamepad_held

Check if a gamepad button is held.

pub fn input_gamepad_held(state: InputState, button: i64) -> bool {

Parameters:

  • state: InputState
  • button: i64

Returns: bool

Defined at line 275


input_gamepad_pressed

Check if a gamepad button was just pressed.

pub fn input_gamepad_pressed(state: InputState, button: i64) -> bool {

Parameters:

  • state: InputState
  • button: i64

Returns: bool

Defined at line 283


input_gamepad_left_x

Get left stick X axis (-1.0 to 1.0).

pub fn input_gamepad_left_x(state: InputState) -> f64 {

Parameters:

  • state: InputState

Returns: f64

Defined at line 291


input_gamepad_left_y

Get left stick Y axis (-1.0 to 1.0).

pub fn input_gamepad_left_y(state: InputState) -> f64 {

Parameters:

  • state: InputState

Returns: f64

Defined at line 296


input_gamepad_right_x

Get right stick X axis (-1.0 to 1.0).

pub fn input_gamepad_right_x(state: InputState) -> f64 {

Parameters:

  • state: InputState

Returns: f64

Defined at line 301


input_gamepad_right_y

Get right stick Y axis (-1.0 to 1.0).

pub fn input_gamepad_right_y(state: InputState) -> f64 {

Parameters:

  • state: InputState

Returns: f64

Defined at line 306


input_gamepad_left_trigger

Get left trigger (0.0 to 1.0).

pub fn input_gamepad_left_trigger(state: InputState) -> f64 {

Parameters:

  • state: InputState

Returns: f64

Defined at line 311


input_gamepad_right_trigger

Get right trigger (0.0 to 1.0).

pub fn input_gamepad_right_trigger(state: InputState) -> f64 {

Parameters:

  • state: InputState

Returns: f64

Defined at line 316


input_set_gamepad_button

Set gamepad button state (for platform integration).

pub fn input_set_gamepad_button(state: & mut InputState, button: i64, held: bool) -> void {

Parameters:

  • state: & mut InputState
  • button: i64
  • held: bool

Returns: void

Defined at line 321


input_set_gamepad_axes

Set gamepad axis values (for platform integration).

pub fn input_set_gamepad_axes(state: & mut InputState, lx: f64, ly: f64, rx: f64, ry: f64, lt: f64, rt: f64) -> void {

Parameters:

  • state: & mut InputState
  • lx: f64
  • ly: f64
  • rx: f64
  • ry: f64
  • lt: f64
  • rt: f64

Returns: void

Defined at line 333


input_set_gamepad_connected

Set gamepad connected status.

pub fn input_set_gamepad_connected(state: & mut InputState, connected: bool) -> void {

Parameters:

  • state: & mut InputState
  • connected: bool

Returns: void

Defined at line 343


input_shift_held

Check if either shift key is held.

pub fn input_shift_held(state: InputState) -> bool {

Parameters:

  • state: InputState

Returns: bool

Defined at line 350


input_ctrl_held

Check if either control key is held.

pub fn input_ctrl_held(state: InputState) -> bool {

Parameters:

  • state: InputState

Returns: bool

Defined at line 355


input_alt_held

Check if either alt key is held.

pub fn input_alt_held(state: InputState) -> bool {

Parameters:

  • state: InputState

Returns: bool

Defined at line 360


input_direction

Get directional input as a normalized vector (dx, dy). Combines keyboard arrows, WASD, and gamepad left stick.

pub fn input_direction(state: InputState) -> (f64, f64) {

Parameters:

  • state: InputState

Returns: (f64, f64)

Defined at line 368


Generated by scribe, the Fides documentation generator