$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
app_ui.c File Reference
#include "app_ui.h"
#include "action_notifier.h"
#include "adaptive_sampler.h"
#include "app.h"
#include "app_binding.h"
#include "app_settings.h"
#include "glad/glad.h"
#include "postprocess.h"
#include "texture.h"
#include "ui.h"
#include "utils.h"
#include <GLFW/glfw3.h>
#include <stb_image.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for app_ui.c:

Functions

static void draw_exposure_overlay (const App *app, UILayout *layout)
 
static void draw_loading_indicator (const App *app)
 
static void draw_help_overlay_keys (const App *app, float start_x, float start_y, float total_h, const KeyboardLayoutConfig *scaled_cfg)
 
static void draw_key_layer_base (UIContext *ui_ctx, const AppUIOverlay *overlay, const KeyboardLayoutConfig *scaled_cfg, const KeyPos *pos, float pos_x, float pos_y, const vec3 base_col, bool has_binding, bool is_pressed, bool is_hovered, float global_dim_mult, int screen_width, int screen_height)
 
static void draw_key_layer_effects (UIContext *ui_ctx, const AppUIOverlay *overlay, const KeyboardLayoutConfig *scaled_cfg, const KeyPos *pos, float pos_x, float pos_y, const vec3 base_col, bool is_pressed, bool is_hovered, int screen_width, int screen_height)
 
static void draw_key_layer_label (UIContext *ui_ctx, const KeyboardLayoutConfig *scaled_cfg, const KeyPos *pos, float pos_x, float pos_y, int screen_width, int screen_height)
 
static void draw_text_centered (UIContext *ui_ctx, const char *text, float pos_x, float pos_y, float scale, int screen_width, int screen_height)
 
static const AppBindingget_active_binding (const AppBindingRegistry *registry, int key, int mods, int *out_effective_mods)
 
void app_ui_init (AppUIOverlay *overlay)
 
void app_ui_cleanup (AppUIOverlay *overlay)
 
void app_ui_update (AppUIOverlay *overlay, double delta_time)
 
void app_ui_handle_mouse (AppUIOverlay *overlay, double xpos, double ypos, int screen_width, int screen_height)
 
static void get_key_base_color (const AppBindingRegistry *registry, int key, vec3 out_col, bool *out_has_binding)
 
static bool is_modifier_relevant (int key, int pressed_key, int pressed_mods)
 
void app_draw_help_overlay (const App *app)
 Draws the help overlay with keyboard shortcuts. More...
 
static bool is_key_active_in_overlay (int key_to_test, int active_key, int active_mods)
 
static void draw_exposure_debug_text (const App *app)
 
static void draw_luminance_histogram_graph (const App *app, const int *buckets, int size, float min_lum, float max_lum)
 
static void draw_bloom_debug_status (const App *app, UILayout *layout)
 
void app_draw_debug_overlay (const App *app)
 Draws the debug overlay with performance metrics and settings. More...
 
static void draw_main_info_overlay (const App *app, UILayout *layout)
 
static void draw_cinematic_overlay (const App *app, UILayout *layout)
 
void app_render_ui (const App *app)
 Main UI rendering entry point. More...
 
int compute_luminance_histogram (const App *app, int *buckets, int size, float *min_lum, float *max_lum)
 Computes the luminance histogram from current frame data. More...
 

Function Documentation

◆ app_draw_debug_overlay()

void app_draw_debug_overlay ( const App app)

Draws the debug overlay with performance metrics and settings.

Parameters
appPointer to the application state.
Here is the call graph for this function:

◆ app_draw_help_overlay()

void app_draw_help_overlay ( const App app)

Draws the help overlay with keyboard shortcuts.

Parameters
appPointer to the application state.
Here is the call graph for this function:

◆ app_render_ui()

void app_render_ui ( const App app)

Main UI rendering entry point.

Orchestrates all UI elements (overlays, histograms, loading spinners).

Parameters
appPointer to the application state.
Here is the call graph for this function:

◆ app_ui_cleanup()

void app_ui_cleanup ( AppUIOverlay overlay)
Here is the call graph for this function:

◆ app_ui_handle_mouse()

void app_ui_handle_mouse ( AppUIOverlay overlay,
double  xpos,
double  ypos,
int  screen_width,
int  screen_height 
)

◆ app_ui_init()

void app_ui_init ( AppUIOverlay overlay)
Here is the call graph for this function:

◆ app_ui_update()

void app_ui_update ( AppUIOverlay overlay,
double  delta_time 
)

◆ compute_luminance_histogram()

int compute_luminance_histogram ( const App app,
int *  buckets,
int  size,
float *  min_lum,
float *  max_lum 
)

Computes the luminance histogram from current frame data.

Scans the luminance buffer to populate buckets for visualization.

Parameters
appPointer to the application state.
bucketsArray to fill with histogram data.
sizeNumber of buckets in the array.
[out]min_lumMinimum luminance found in the data.
[out]max_lumMaximum luminance found in the data.
Returns
Number of samples processed or error code.
Here is the call graph for this function:

◆ draw_bloom_debug_status()

static void draw_bloom_debug_status ( const App app,
UILayout layout 
)
static
Here is the call graph for this function:

◆ draw_cinematic_overlay()

static void draw_cinematic_overlay ( const App app,
UILayout layout 
)
static
Here is the call graph for this function:

◆ draw_exposure_debug_text()

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

◆ draw_exposure_overlay()

static void draw_exposure_overlay ( const App app,
UILayout layout 
)
static
Here is the call graph for this function:

◆ draw_help_overlay_keys()

static void draw_help_overlay_keys ( const App app,
float  start_x,
float  start_y,
float  total_h,
const KeyboardLayoutConfig scaled_cfg 
)
static
Here is the call graph for this function:

◆ draw_key_layer_base()

static void draw_key_layer_base ( UIContext ui_ctx,
const AppUIOverlay overlay,
const KeyboardLayoutConfig scaled_cfg,
const KeyPos pos,
float  pos_x,
float  pos_y,
const vec3  base_col,
bool  has_binding,
bool  is_pressed,
bool  is_hovered,
float  global_dim_mult,
int  screen_width,
int  screen_height 
)
static
Here is the call graph for this function:

◆ draw_key_layer_effects()

static void draw_key_layer_effects ( UIContext ui_ctx,
const AppUIOverlay overlay,
const KeyboardLayoutConfig scaled_cfg,
const KeyPos pos,
float  pos_x,
float  pos_y,
const vec3  base_col,
bool  is_pressed,
bool  is_hovered,
int  screen_width,
int  screen_height 
)
static
Here is the call graph for this function:

◆ draw_key_layer_label()

static void draw_key_layer_label ( UIContext ui_ctx,
const KeyboardLayoutConfig scaled_cfg,
const KeyPos pos,
float  pos_x,
float  pos_y,
int  screen_width,
int  screen_height 
)
static
Here is the call graph for this function:

◆ draw_loading_indicator()

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

◆ draw_luminance_histogram_graph()

static void draw_luminance_histogram_graph ( const App app,
const int *  buckets,
int  size,
float  min_lum,
float  max_lum 
)
static
Here is the call graph for this function:

◆ draw_main_info_overlay()

static void draw_main_info_overlay ( const App app,
UILayout layout 
)
static
Here is the call graph for this function:

◆ draw_text_centered()

static void draw_text_centered ( UIContext ui_ctx,
const char *  text,
float  pos_x,
float  pos_y,
float  scale,
int  screen_width,
int  screen_height 
)
static
Here is the call graph for this function:

◆ get_active_binding()

static const AppBinding * get_active_binding ( const AppBindingRegistry registry,
int  key,
int  mods,
int *  out_effective_mods 
)
static
Here is the call graph for this function:

◆ get_key_base_color()

static void get_key_base_color ( const AppBindingRegistry registry,
int  key,
vec3  out_col,
bool *  out_has_binding 
)
static
Here is the call graph for this function:

◆ is_key_active_in_overlay()

static bool is_key_active_in_overlay ( int  key_to_test,
int  active_key,
int  active_mods 
)
static
Here is the call graph for this function:

◆ is_modifier_relevant()

static bool is_modifier_relevant ( int  key,
int  pressed_key,
int  pressed_mods 
)
static