vtgl

terminal emulator implemented in OpenGL
git clone anongit@rnpnr.xyz:vtgl.git
Log | Files | Refs | Feed | LICENSE

Commit: e2ff94b95e6c84c27b2aaa51aee38457b94fadb3
Parent: 216c2baee2b37bcc99db63176fbbb5f71cda4c63
Author: Randy Palamar
Date:   Mon,  2 Dec 2024 05:50:33 -0700

allow live update of debug overlay at the input poll rate

Diffstat:
Mdebug.c | 13+++++--------
Mvtgl.c | 3++-
2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/debug.c b/debug.c @@ -189,14 +189,11 @@ draw_debug_bar_chart(Term *t, DebugState *ds, TerminalInput *input, RenderCtx *r { BEGIN_TIMED_BLOCK(); - f32 bar_thick = ds->bar_thickness; - f32 bar_pad = 0.5 * ds->bar_thickness; - v2 pos = bar_chart_top_left; - /* TODO */ - //f32 secs_scale = bar_chart_magnitude / ds->frame_target_time; - f32 target_fps = 60; - f32 target_time = 1 / target_fps; - f32 secs_scale = bar_chart_magnitude * target_fps; + f32 bar_thick = ds->bar_thickness; + f32 bar_pad = 0.5 * ds->bar_thickness; + v2 pos = bar_chart_top_left; + f32 target_time = ds->frame_target_time; + f32 secs_scale = bar_chart_magnitude / ds->frame_target_time; /* TODO */ v4 fg = normalize_colour((Colour){.rgba = 0x1e9e33ff}); diff --git a/vtgl.c b/vtgl.c @@ -871,6 +871,7 @@ DEBUG_EXPORT VTGL_HANDLE_KEYS_FN(vtgl_handle_keys) } if (key == KEY_F12 && action == ACT_PRESS) { t->gl.flags ^= DRAW_DEBUG_OVERLAY; + input->window_refreshed = 1; return; } #endif @@ -1368,7 +1369,7 @@ DEBUG_EXPORT VTGL_FRAME_STEP_FN(vtgl_frame_step) END_TIMED_BLOCK(); - return t->gl.queued_render || input->window_refreshed; + return t->gl.queued_render || input->window_refreshed || t->gl.flags & DRAW_DEBUG_OVERLAY; } #ifdef _DEBUG