$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
app_input.h File Reference

User input orchestration and application state toggles. More...

#include "gl_common.h"
Include dependency graph for app_input.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void key_callback (GLFWwindow *window, int key, int scancode, int action, int mods)
 Primary GLFW key callback. More...
 
void mouse_callback (GLFWwindow *window, double xpos, double ypos)
 Primary GLFW mouse position callback. More...
 
void scroll_callback (GLFWwindow *window, double xoffset, double yoffset)
 Primary GLFW scroll callback. More...
 
void framebuffer_size_callback (GLFWwindow *window, int width, int height)
 Primary GLFW framebuffer size callback. More...
 
void handle_app_input (App *app, int key, int mods)
 Dispatches application-level logic for key inputs. More...
 
void app_handle_env_input (App *app, int action, int mods, int key)
 Handles input for cycling environment maps. More...
 
void app_toggle_fullscreen (App *app, GLFWwindow *window)
 Toggles the application window between Windowed and Fullscreen. More...
 
void app_save_png_frame (App *app, const char *filename)
 Captures the current framebuffer and saves it as a PNG file. More...
 

Detailed Description

User input orchestration and application state toggles.

This module manages all high-level input logic, bridging GLFW raw events to application-specific actions like post-processing toggles, environment map switching, and camera movement.

Function Documentation

◆ app_handle_env_input()

void app_handle_env_input ( App app,
int  action,
int  mods,
int  key 
)

Handles input for cycling environment maps.

Parameters
appPointer to the application state.
actionGLFW action (Press/Release).
modsModifiers.
keyDirectional key.
Here is the call graph for this function:

◆ app_save_png_frame()

void app_save_png_frame ( App app,
const char *  filename 
)

Captures the current framebuffer and saves it as a PNG file.

Parameters
appPointer to the application state.
filenameOutput file path (should end in .png).

◆ app_toggle_fullscreen()

void app_toggle_fullscreen ( App app,
GLFWwindow window 
)

Toggles the application window between Windowed and Fullscreen.

Parameters
appPointer to the application state.
windowGLFW window handle.

◆ framebuffer_size_callback()

void framebuffer_size_callback ( GLFWwindow window,
int  width,
int  height 
)

Primary GLFW framebuffer size callback.

Handles resizing of the OpenGL viewport and all dependent post-processing buffers to match the new window dimensions.

Parameters
windowThe GLFW window context.
widthNew framebuffer width.
heightNew framebuffer height.
Note
Reallocates many GPU textures via postprocess_resize.

◆ handle_app_input()

void handle_app_input ( App app,
int  key,
int  mods 
)

Dispatches application-level logic for key inputs.

Handles system-wide shortcuts (ESC to exit, Space to pause, etc.).

Parameters
appPointer to the application state.
keyLocked key code.
modsActive modifiers.
Here is the call graph for this function:

◆ key_callback()

void key_callback ( GLFWwindow window,
int  key,
int  scancode,
int  action,
int  mods 
)

Primary GLFW key callback.

Dispatches raw key events to handle_app_input, camera_process_key_callback, and other specific handlers.

Parameters
windowThe GLFW window context.
keyThe keyboard key code.
scancodeSystem-specific scancode.
actionGLFW_PRESS, GLFW_RELEASE, or GLFW_REPEAT.
modsActive modifier keys (Shift, Ctrl, Alt).
Here is the call graph for this function:

◆ mouse_callback()

void mouse_callback ( GLFWwindow window,
double  xpos,
double  ypos 
)

Primary GLFW mouse position callback.

Parameters
windowThe GLFW window context.
xposAbsolute mouse X-coordinate.
yposAbsolute mouse Y-coordinate.
Here is the call graph for this function:

◆ scroll_callback()

void scroll_callback ( GLFWwindow window,
double  xoffset,
double  yoffset 
)

Primary GLFW scroll callback.

Parameters
windowThe GLFW window context.
xoffsetScroll amount along the X-axis.
yoffsetScroll amount along the Y-axis.
Here is the call graph for this function: