From 6b5425ebd35c28e20680f5f28c887b705827ba1c Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 27 Oct 2026 18:53:32 +0100 Subject: GUI: add on-screen toasts and atomic config writes - Toast queue drawn in the top-right by the overlay, independent of the GUI being open. Info/warn/error colors and 6/9/12 s lifetimes; timers start on the first painted frame so startup messages are not missed. - Queue a load toast after install_menu, plus warnings/errors for missing modules/interfaces/netvars, input hooks, fonts, ISurface, server datamap, and spread seed support. - Toast on config reload, reset, bind/unbind and config save failure. - Config saves now write `config.tmp`, flush, then rename it over the real file; failures leave the previous config intact. - config_load reports whether a file was found so Reload can distinguish a successful reload from a missing file. - Update CONTEXT and ISURFACE_STATUS for the single GUI, toasts and atomic config writes. --- src/hl2h.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/hl2h.h') diff --git a/src/hl2h.h b/src/hl2h.h index 0f03925..e390aa0 100644 --- a/src/hl2h.h +++ b/src/hl2h.h @@ -22,6 +22,15 @@ constexpr float PI_F = 3.14159265f; void logf(const char *fmt, ...); +// --------------------------------------------------------------------------- +// on-screen toasts +// --------------------------------------------------------------------------- + +enum ToastLevel { TOAST_INFO = 0, TOAST_WARN, TOAST_ERROR }; +void toastf(int level, const char *fmt, ...); +bool gui_toasts_active(); +void gui_draw_toasts(); + // --------------------------------------------------------------------------- // module discovery // --------------------------------------------------------------------------- -- cgit v1.2.3