Skip to main content

Crate sge_input

Crate sge_input 

Source

Modules§

helper
keys

Structs§

Action
Input

Enums§

Button
InputError
Key
Key represents the meaning of a keypress.
KeyCode
Code representing the location of a physical key
MouseButton
Describes a button of a mouse controller.

Functions§

action_held
Returns true while the action’s bound button remains “pressed”. Otherwise returns false.
action_pressed
Returns true when the action’s bound button goes from “not pressed” to “pressed”. Otherwise returns false.
action_pressed_os
Returns true when the action’s bound button goes from “not pressed” to “pressed”. Otherwise returns false.
action_released
Returns true when the action’s bound button goes from “pressed” to “not pressed”. Otherwise returns false.
bind
Binds a button (either keyboard or mouse) to an action.
button_held
button_pressed
button_released
close_requested
Returns true if the OS has requested the application to close during this step. Otherwise returns false.
cursor
Returns the cursor coordinates in pixels, when window is focused AND (cursor is on window OR any mouse button remains held while cursor moved off window). Otherwise returns None.
cursor_diff
Returns the change in cursor coordinates that occurred during the last step, when window is focused AND (cursor is on window OR any mouse button remains held while cursor moved off window). Otherwise returns (0.0, 0.0).
cursor_prev
destroyed
Returns true if the window has been destroyed. Otherwise returns false.
dropped_file
Returns the path to a file that has been drag-and-dropped onto the window.
get_all_binds
Get a map of all the bindings that have been registered with the engine.
get_input
held_alt
Returns true while any alt key is held on the keyboard. Otherwise returns false.
held_control
Returns true while any control key is held on the keyboard. Otherwise returns false.
held_shift
Returns true while any shift key is held on the keyboard. Otherwise returns false.
hovered_file
Returns the path to a file that the OS is currently dragging over the window, if any.
init
input_text
Returns the characters pressed during the last step. The characters are in the order they were pressed.
is_focused
key_held
Returns true when the key with the specified keycode remains “pressed”. Otherwise returns false.
key_held_logical
Returns true while the specified keyboard key remains “pressed”. Otherwise returns false.
key_pressed
Returns true when the key with the specified keycode goes from “not pressed” to “pressed”. Otherwise returns false.
key_pressed_logical
Returns true when the specified keyboard key goes from “not pressed” to “pressed”. Otherwise returns false.
key_pressed_os
Returns true when the key with the specified keycode goes from “not pressed” to “pressed”. Otherwise returns false.
key_pressed_os_logical
Returns true when the specified keyboard key goes from “not pressed” to “pressed”. Otherwise returns false.
key_released
Returns true when the key with the specified KeyCode goes from “pressed” to “not pressed”. Otherwise returns false.
key_released_logical
Returns true when the specified keyboard key goes from “pressed” to “not pressed”. Otherwise returns false.
last_cursor_pos
Returns current cursor pos if cursor is inside the window. Otherwise returns the last cursor pos before the cursor left the window.
maybe_get_input
mouse_diff
Returns the change in mouse coordinates that occurred during the last step.
mouse_held
Returns true while the specified mouse button remains “pressed”. Otherwise returns false.
mouse_pressed
Returns true when the specified mouse button goes from “not pressed” to “pressed”. Otherwise returns false.
mouse_released
Returns true when the specified mouse button goes from “pressed” to “not pressed”. Otherwise returns false.
open_url
pressed_movement_vector
Create a 2D movement vector from four input directions
resolution
Returns the current resolution of the window.
scale_factor
Returns the current scale_factor of the window.
scale_factor_changed
Returns the current scale factor if it was changed during the last step. Otherwise returns None.
scroll_diff
Returns the amount scrolled by the mouse during the last step. Returns (horizontally, vertically).
should_quit
update
window_resized
Returns the current window size if it was resized during the last step. Otherwise returns None.