|
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
|
Input handling adapter for the Camera system. More...
Go to the source code of this file.
Functions | |
| void | camera_input_handle_key (Camera *cam, int key, int action) |
| Processes a keyboard event to update camera movement flags. | |
| void | camera_input_handle_mouse (Camera *cam, double xpos, double ypos) |
| Processes a mouse movement event to update camera orientation. | |
| void | camera_input_handle_scroll (Camera *cam, double yoffset) |
| Processes a scroll event to adjust camera speed or zoom. | |
| void | camera_apply_gamepad (Camera *cam, const GamepadState *state) |
| Applies gamepad input to camera within a fixed physics step. | |
Input handling adapter for the Camera system.
This module bridges raw input events (keys, mouse, scroll) to the Camera's internal state and logic. It decouples the input source (e.g., GLFW) from the Camera implementation.
| void camera_apply_gamepad | ( | Camera * | cam, |
| const GamepadState * | state | ||
| ) |
Applies gamepad input to camera within a fixed physics step.
Encapsulates the Camera↔GamepadContext copy-in/copy-out pattern: builds the GamepadContext from Camera fields, calls gamepad_write_input(), then copies modified values back into the Camera.
| cam | Pointer to the Camera instance (move_input, yaw/pitch_target). |
| state | Pointer to the gamepad state (with cached axes from poll). |
| void camera_input_handle_key | ( | Camera * | cam, |
| int | key, | ||
| int | action | ||
| ) |
Processes a keyboard event to update camera movement flags.
Maps specific keys (W, A, S, D, Q, E) to camera movement directions.
| cam | Pointer to the Camera instance. |
| key | The key code (e.g., GLFW_KEY_W). |
| action | The key action (e.g., GLFW_PRESS, GLFW_RELEASE). |
| void camera_input_handle_mouse | ( | Camera * | cam, |
| double | xpos, | ||
| double | ypos | ||
| ) |
Processes a mouse movement event to update camera orientation.
Calculates the delta from the last known position stored in the Camera struct and applies rotation (yaw/pitch).
| cam | Pointer to the Camera instance. |
| xpos | The current absolute X coordinate of the mouse. |
| ypos | The current absolute Y coordinate of the mouse. |