sokol_input.h
IntroductionInput handling for sokol_app DiscussionProvides an input manager for sokol_app, handling keyboard, mouse, and gamepad input.
Functions
sapp_any_buttons_downCheck if any of the mouse buttons are currently pressed down. bool sapp_any_buttons_down( int n, ...); ParametersReturn ValueTrue if any of the buttons are currently pressed down. sapp_any_keys_downCheck if any of the keys are currently pressed down. bool sapp_any_keys_down( int n, ...); ParametersReturn ValueTrue if any of the keys are currently pressed down. sapp_are_buttons_downCheck if multiple mouse buttons are currently pressed down. bool sapp_are_buttons_down( int n, ...); ParametersReturn ValueTrue if all the buttons are currently pressed down. sapp_are_keys_downCheck if multiple keys are currently pressed down. bool sapp_are_keys_down( int n, ...); ParametersReturn ValueTrue if all the keys are currently pressed down. sapp_cursor_delta_xGet the change in x position of the mouse cursor since the last frame. int sapp_cursor_delta_x( void); Return ValueThe change in x position of the mouse cursor since the last frame. sapp_cursor_delta_yGet the change in y position of the mouse cursor since the last frame. int sapp_cursor_delta_y( void); Return ValueThe change in y position of the mouse cursor since the last frame. sapp_cursor_xGet the current x position of the mouse cursor. int sapp_cursor_x( void); Return ValueThe current x position of the mouse cursor. sapp_cursor_yGet the current y position of the mouse cursor. int sapp_cursor_y( void); Return ValueThe current y position of the mouse cursor. sapp_has_mouse_moveCheck if the mouse has moved since the last frame. bool sapp_has_mouse_move( void); Return ValueTrue if the mouse has moved since the last frame. sapp_input_eventCall this function to handle input events. void sapp_input_event( const sapp_event *event); ParametersDiscussionThis function should be called in the sapp event callback to process input events. Or it can be used directly by passing it as the event handler in sapp_run. sapp_input_flushFlush the input state. void sapp_input_flush( void); DiscussionCall this function at the end of each frame to update the input state. sapp_input_initInitialize the input system. void sapp_input_init( void); DiscussionCall this function to initialize the input system. Either before sapp_run or in the sapp init callback. sapp_is_button_downCheck if a mouse button is currently pressed down. bool sapp_is_button_down( int button); ParametersReturn ValueTrue if the mouse button is currently pressed down. sapp_is_key_downCheck if a key is currently pressed down. bool sapp_is_key_down( int key); ParametersReturn ValueTrue if the key is currently pressed down. sapp_modifier_downCheck if a specific modifier key is currently pressed down. bool sapp_modifier_down( int mod); ParametersReturn ValueTrue if the specified modifier key is currently pressed down. sapp_modifier_equalsCheck if the current modifier keys match the specified ones. bool sapp_modifier_equals( int mods); ParametersReturn ValueTrue if the current modifiers match the specified ones. sapp_scroll_xGet the amount the mouse wheel has been scrolled in the x direction since the last frame. float sapp_scroll_x( void); Return ValueThe amount the mouse wheel has been scrolled in the x direction since the last frame. sapp_scroll_yGet the amount the mouse wheel has been scrolled in the y direction since the last frame. float sapp_scroll_y( void); Return ValueThe amount the mouse wheel has been scrolled in the y direction since the last frame. sapp_was_button_pressedCheck if a mouse button was pressed down in the last frame. bool sapp_was_button_pressed( int button); ParametersReturn ValueTrue if the mouse button was pressed down in the last frame. sapp_was_button_releasedCheck if a mouse button was released in the last frame. bool sapp_was_button_released( int button); ParametersReturn ValueTrue if the mouse button was released in the last frame. sapp_was_key_pressedCheck if a key was pressed down in the last frame. bool sapp_was_key_pressed( int key); ParametersReturn ValueTrue if the key was pressed down in the last frame. sapp_was_key_releasedCheck if a key was released in the last frame. bool sapp_was_key_released( int key); ParametersReturn ValueTrue if the key was released in the last frame. sapp_was_mouse_scrolledCheck if the mouse wheel has been scrolled since the last frame. bool sapp_was_mouse_scrolled( void); Return ValueTrue if the mouse wheel has been scrolled since the last frame. |