[client] overlay: add app_invalidateOverlay method

This commit is contained in:
Geoffrey McRae 2022-01-08 15:18:40 +11:00
parent ad6fa5a504
commit 0080e5f1b9
3 changed files with 15 additions and 4 deletions

View File

@ -102,6 +102,12 @@ int app_renderOverlay(struct Rect * rects, int maxRects);
void app_freeOverlays(void);
/**
* invalidate the window to update the overlay, if renderTwice is set the imgui
* render code will run twice so that auto sized windows are calculated correctly
*/
void app_invalidateOverlay(bool renderTwice);
struct OverlayGraph;
typedef struct OverlayGraph * GraphHandle;

View File

@ -622,9 +622,6 @@ void app_alert(LG_MsgAlert type, const char * fmt, ...)
va_start(args, fmt);
overlayAlert_show(type, fmt, args);
va_end(args);
g_state.renderImGuiTwice = true;
app_invalidateWindow(false);
}
KeybindHandle app_registerKeybind(int sc, KeybindFn callback, void * opaque, const char * description)
@ -915,3 +912,10 @@ void app_overlayConfigRegisterTab(const char * title,
{
overlayConfig_registerTab(title, callback, udata);
}
void app_invalidateOverlay(bool renderTwice)
{
if (renderTwice)
g_state.renderImGuiTwice = true;
app_invalidateWindow(false);
}

View File

@ -130,5 +130,6 @@ void overlayAlert_show(LG_MsgAlert type, const char * fmt, va_list args)
l_alert.timeout = ALERT_TIMEOUT;
l_alert.type = type;
l_alert.show = true;
l_alert.redraw = true;
app_invalidateOverlay(true);
}