Input layer implementation.
More...
Go to the source code of this file.
Input layer implementation.
Definition in file input.c.
◆ input_state
State of the input system.
◆ input_initialize()
b8 input_initialize |
( |
void |
| ) |
|
Initialize the input system.
Prepares the internal state to process and serve input information. Must be called once before using the input system.
- Returns
- false if an error occurred, true if succesful
Definition at line 43 of file input.c.
◆ input_is_key_down()
Check if a key is currently down.
- Parameters
-
key | the key_code of the key to check |
- Returns
- true if the key is currently down, false otherwise
Definition at line 57 of file input.c.
◆ input_is_key_held()
Check if a key is held.
A key is being held when it was down and is currently still down.
- Parameters
-
key | the key_code of the key to check |
- Returns
- true if the key is held, false otherwise
Definition at line 77 of file input.c.
◆ input_is_key_up()
Check if a key is currently up.
- Parameters
-
key | the key_code of the key to check |
- Returns
- true if the key is currently up, false otherwise
Definition at line 67 of file input.c.
◆ input_mouse_moved()
b8 input_mouse_moved |
( |
u32 * |
x, |
|
|
u32 * |
y |
|
) |
| |
Check if mouse moved.
- Parameters
-
x | points to x delta of the mouse since last update, will be populated by the function |
y | points to y delta of the mouse since last update, will be populated by the function |
- Returns
- false if mouse did not move since last update, true if it moved
Definition at line 87 of file input.c.
◆ input_mouse_position()
void input_mouse_position |
( |
u32 * |
x, |
|
|
u32 * |
y |
|
) |
| |
Get current mouse position.
- Parameters
-
x | points to x coordinate of the mouse, will be populated by the function |
y | points to y coordinate of the mouse, will be populated by the function |
Definition at line 82 of file input.c.
◆ input_mouse_wheel()
i8 input_mouse_wheel |
( |
void |
| ) |
|
Get current mouse wheel scrolling direction.
- Returns
- 1 if scrolling down, -1 if scrolling up, 0 if no input
Definition at line 93 of file input.c.
◆ input_process_key()
void input_process_key |
( |
key_code |
key, |
|
|
b8 |
pressed |
|
) |
| |
Set current state for a key.
- Parameters
-
key | the key_code of the key to update |
pressed | the current state of the key |
Definition at line 95 of file input.c.
◆ input_process_mouse_position()
void input_process_mouse_position |
( |
u32 |
x, |
|
|
u32 |
y |
|
) |
| |
Set current state for the mouse position.
- Parameters
-
x | the current x coordinate of the mouse |
y | the current y coordinate of the mouse |
Definition at line 100 of file input.c.
◆ input_process_mouse_wheel()
void input_process_mouse_wheel |
( |
i8 |
wheel_pos | ) |
|
Set current scrolling wheel direction for the mouse.
- Parameters
-
wheel_pos | the current direction of the mouse wheel |
Definition at line 105 of file input.c.
◆ input_update()
void input_update |
( |
f64 |
delta_time | ) |
|
Updates the input system.
This should be called every frame before prolling window events.
- Parameters
-
delta_time | the time that passed since the last update |
Definition at line 51 of file input.c.
◆ input_was_key_down()
Check if a key was down before the last update.
- Parameters
-
key | the key_code of the key to check |
- Returns
- true if the key was down, false otherwise
Definition at line 62 of file input.c.
◆ input_was_key_up()
Check if a key was up before the last update.
- Parameters
-
key | the key_code of the key to check |
- Returns
- true if the key was up, false otherwise
Definition at line 72 of file input.c.