$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
app_input.c File Reference
#include "app_input.h"
#include "action_notifier.h"
#include "app.h"
#include "app_settings.h"
#include "app_ui.h"
#include "camera.h"
#include "camera_input.h"
#include "env_manager.h"
#include "glad/glad.h"
#include "log.h"
#include "perf_mode.h"
#include "postprocess_input.h"
#include "profiler.h"
#include "scene.h"
#include "utils.h"
#include "window.h"
#include <GLFW/glfw3.h>
#include <stb_image_write.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for app_input.c:

Enumerations

enum  { PBR_DEBUG_MODE_COUNT = 10 }
 
enum  { NOTIF_BUF_SIZE = 128 }
 

Functions

void framebuffer_size_callback (GLFWwindow *window, int width, int height)
 Primary GLFW framebuffer size callback. More...
 
static void handle_pbr_debug_mode (App *app)
 
static void handle_aa_mode_input (App *app)
 
void app_handle_env_input (App *app, int action, int mods, int key)
 Handles input for cycling environment maps. More...
 
static void handle_overlay_input (App *app)
 
static void handle_subdiv_input (App *app, int key)
 
static void handle_camera_toggle (App *app)
 
static void handle_f3_input (App *app, int mods)
 
static void handle_f9_input (App *app)
 
static void app_toggle_help (App *app)
 
static bool handle_f_key_input (App *app, int key, int mods)
 
static void handle_y_key_input (App *app, int mods)
 
static void handle_system_key_input (App *app, int key, int mods)
 
void handle_app_input (App *app, int key, int mods)
 Dispatches application-level logic for key inputs. More...
 
void key_callback (GLFWwindow *window, int key, int scancode, int action, int mods)
 Primary GLFW key callback. More...
 
void app_toggle_fullscreen (App *app, GLFWwindow *window)
 Toggles the application window between Windowed and Fullscreen. 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 app_save_png_frame (App *app, const char *filename)
 Captures the current framebuffer and saves it as a PNG file. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PBR_DEBUG_MODE_COUNT 

◆ anonymous enum

anonymous enum
Enumerator
NOTIF_BUF_SIZE 

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.

◆ app_toggle_help()

static void app_toggle_help ( App app)
static
Here is the call graph for this function:

◆ 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_aa_mode_input()

static void handle_aa_mode_input ( App app)
static
Here is the call graph for this function:

◆ 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:

◆ handle_camera_toggle()

static void handle_camera_toggle ( App app)
static
Here is the call graph for this function:

◆ handle_f3_input()

static void handle_f3_input ( App app,
int  mods 
)
static
Here is the call graph for this function:

◆ handle_f9_input()

static void handle_f9_input ( App app)
static
Here is the call graph for this function:

◆ handle_f_key_input()

static bool handle_f_key_input ( App app,
int  key,
int  mods 
)
static
Here is the call graph for this function:

◆ handle_overlay_input()

static void handle_overlay_input ( App app)
static
Here is the call graph for this function:

◆ handle_pbr_debug_mode()

static void handle_pbr_debug_mode ( App app)
static
Here is the call graph for this function:

◆ handle_subdiv_input()

static void handle_subdiv_input ( App app,
int  key 
)
static
Here is the call graph for this function:

◆ handle_system_key_input()

static void handle_system_key_input ( App app,
int  key,
int  mods 
)
static
Here is the call graph for this function:

◆ handle_y_key_input()

static void handle_y_key_input ( App app,
int  mods 
)
static
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: