From ec0bd6adc89d412c3cf21774e71413b80a1e2f07 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Sat, 8 Jan 2022 00:26:12 +1100 Subject: [PATCH] [client] imgui: update to cimgui 1.86 --- client/renderers/EGL/desktop.c | 3 ++- client/renderers/EGL/egl.c | 1 + client/renderers/EGL/filter_downscale.c | 2 +- client/renderers/EGL/postprocess.c | 13 +++++++------ client/src/app.c | 6 ++++-- client/src/overlay/alert.c | 6 +++--- client/src/overlay/config.c | 16 ++++++++-------- client/src/overlay/fps.c | 4 ++-- client/src/overlay/graphs.c | 2 +- client/src/overlay_utils.c | 3 ++- repos/cimgui | 2 +- 11 files changed, 32 insertions(+), 26 deletions(-) diff --git a/client/renderers/EGL/desktop.c b/client/renderers/EGL/desktop.c index c5c95794..e1a8f411 100644 --- a/client/renderers/EGL/desktop.c +++ b/client/renderers/EGL/desktop.c @@ -228,7 +228,8 @@ void egl_desktopConfigUI(EGL_Desktop * desktop) for (int i = 0; i < EGL_SCALE_MAX; ++i) { bool selected = i == desktop->scaleAlgo; - if (igSelectableBool(algorithmNames[i], selected, 0, (ImVec2) { 0.0f, 0.0f })) + if (igSelectable_Bool(algorithmNames[i], selected, 0, + (ImVec2) { 0.0f, 0.0f })) desktop->scaleAlgo = i; if (selected) igSetItemDefaultFocus(); diff --git a/client/renderers/EGL/egl.c b/client/renderers/EGL/egl.c index 4e5d9ec8..fdf5ee4c 100644 --- a/client/renderers/EGL/egl.c +++ b/client/renderers/EGL/egl.c @@ -493,6 +493,7 @@ static void egl_onResize(LG_Renderer * renderer, const int width, const int heig // this is needed to refresh the font atlas texture ImGui_ImplOpenGL3_Shutdown(); + ImGui_ImplOpenGL3_Init("#version 300 es"); ImGui_ImplOpenGL3_NewFrame(); egl_damageResize(this->damage, this->translateX, this->translateY, this->scaleX, this->scaleY); diff --git a/client/renderers/EGL/filter_downscale.c b/client/renderers/EGL/filter_downscale.c index b9e8b3a2..43be4be4 100644 --- a/client/renderers/EGL/filter_downscale.c +++ b/client/renderers/EGL/filter_downscale.c @@ -268,7 +268,7 @@ static bool egl_filterDownscaleImguiConfig(EGL_Filter * filter) for (int i = 0; i < DOWNSCALE_COUNT; ++i) { bool selected = i == this->filter; - if (igSelectableBool(filterNames[i], selected, 0, (ImVec2) { 0.0f, 0.0f })) + if (igSelectable_Bool(filterNames[i], selected, 0, (ImVec2) { 0.0f, 0.0f })) { redraw = true; this->filter = i; diff --git a/client/renderers/EGL/postprocess.c b/client/renderers/EGL/postprocess.c index 3db8b0cb..b1d86d08 100644 --- a/client/renderers/EGL/postprocess.c +++ b/client/renderers/EGL/postprocess.c @@ -334,7 +334,8 @@ static bool presetsUI(struct EGL_PostProcess * this) for (unsigned i = 0; i < stringlist_count(this->presets); ++i) { bool selected = i == this->activePreset; - if (igSelectableBool(stringlist_at(this->presets, i), selected, 0, (ImVec2) { 0.0f, 0.0f })) + if (igSelectable_Bool(stringlist_at(this->presets, i), selected, 0, + (ImVec2) { 0.0f, 0.0f })) { this->activePreset = i; redraw = true; @@ -365,7 +366,7 @@ static bool presetsUI(struct EGL_PostProcess * this) if (igButton("Save preset as...", (ImVec2) { 0.0f, 0.0f })) { this->presetEdit[0] = '\0'; - igOpenPopup("Save preset as...", ImGuiPopupFlags_None); + igOpenPopup_Str("Save preset as...", ImGuiPopupFlags_None); } igSameLine(0.0f, -1.0f); @@ -401,7 +402,7 @@ static bool presetsUI(struct EGL_PostProcess * this) } if (this->presetError) - igOpenPopup("Preset error", ImGuiPopupFlags_None); + igOpenPopup_Str("Preset error", ImGuiPopupFlags_None); if (igBeginPopupModal("Preset error", NULL, ImGuiWindowFlags_AlwaysAutoResize)) { @@ -425,7 +426,7 @@ static bool presetsUI(struct EGL_PostProcess * this) static void drawDropTarget(void) { - igPushStyleColorVec4(ImGuiCol_Separator, (ImVec4) { 1.0f, 1.0f, 0.0f, 1.0f }); + igPushStyleColor_Vec4(ImGuiCol_Separator, (ImVec4) { 1.0f, 1.0f, 0.0f, 1.0f }); igSeparator(); igPopStyleColor(1); } @@ -456,8 +457,8 @@ static void configUI(void * opaque, int * id) if (moving && mouseIdx < moveIdx && i == mouseIdx) drawDropTarget(); - igPushIDPtr(filter); - bool draw = igCollapsingHeaderBoolPtr(filter->ops.name, NULL, 0); + igPushID_Ptr(filter); + bool draw = igCollapsingHeader_BoolPtr(filter->ops.name, NULL, 0); if (igIsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) mouseIdx = i; diff --git a/client/src/app.c b/client/src/app.c index 28cdfa96..1b2b9a0e 100644 --- a/client/src/app.c +++ b/client/src/app.c @@ -808,8 +808,10 @@ int app_renderOverlay(struct Rect * rects, int maxRects) if (g_state.overlayInput) { totalDamage = true; - ImDrawList_AddRectFilled(igGetBackgroundDrawListNil(), (ImVec2) { 0.0f , 0.0f }, - g_state.io->DisplaySize, igGetColorU32Col(ImGuiCol_ModalWindowDimBg, 1.0f), 0, 0); + ImDrawList_AddRectFilled(igGetBackgroundDrawList_Nil(), (ImVec2) { 0.0f , 0.0f }, + g_state.io->DisplaySize, + igGetColorU32_Col(ImGuiCol_ModalWindowDimBg, 1.0f), + 0, 0); // bool test; // igShowDemoWindow(&test); diff --git a/client/src/overlay/alert.c b/client/src/overlay/alert.c index ece482c6..e46e2bb7 100644 --- a/client/src/overlay/alert.c +++ b/client/src/overlay/alert.c @@ -51,9 +51,9 @@ static int alert_render(void * udata, bool interactive, struct Rect * windowRect igSetNextWindowBgAlpha(0.8f); igSetNextWindowPos((ImVec2) { screen->x / 2.0f, screen->y / 2.0f }, 0, (ImVec2) { 0.5f, 0.5f }); - igPushStyleColorU32(ImGuiCol_WindowBg, colours[g_state.alertType]); - igPushStyleVarVec2(ImGuiStyleVar_WindowPadding, (ImVec2) { 4.0f , 4.0f }); - igPushStyleVarVec2(ImGuiStyleVar_WindowMinSize, (ImVec2) { 0.0f , 0.0f }); + igPushStyleColor_U32(ImGuiCol_WindowBg, colours[g_state.alertType]); + igPushStyleVar_Vec2(ImGuiStyleVar_WindowPadding, (ImVec2) { 4.0f , 4.0f }); + igPushStyleVar_Vec2(ImGuiStyleVar_WindowMinSize, (ImVec2) { 0.0f , 0.0f }); igBegin( "Alert", diff --git a/client/src/overlay/config.c b/client/src/overlay/config.c index 7cdf0d6d..3ef93b54 100644 --- a/client/src/overlay/config.c +++ b/client/src/overlay/config.c @@ -78,7 +78,7 @@ static void config_renderLGTab(void) { const float fontSize = igGetFontSize(); - if (igCollapsingHeaderBoolPtr("About", NULL, + if (igCollapsingHeader_BoolPtr("About", NULL, ImGuiTreeNodeFlags_DefaultOpen)) { igText(LG_COPYRIGHT_STR); @@ -88,7 +88,7 @@ static void config_renderLGTab(void) igTextWrapped(LG_LICENSE_STR); } - if (igCollapsingHeaderBoolPtr("Help & Support", NULL, + if (igCollapsingHeader_BoolPtr("Help & Support", NULL, ImGuiTreeNodeFlags_DefaultOpen)) { igBeginTable("split", 2, 0, (ImVec2){}, 0.0f); @@ -103,12 +103,12 @@ static void config_renderLGTab(void) igEndTable(); } - if (igCollapsingHeaderBoolPtr("The Looking Glass Team / Donations", NULL, + if (igCollapsingHeader_BoolPtr("The Looking Glass Team / Donations", NULL, ImGuiTreeNodeFlags_DefaultOpen)) { for(const struct LGTeamMember * member = LG_TEAM; member->name; ++member) { - if (igTreeNodeStr(member->name)) + if (igTreeNode_Str(member->name)) { igSpacing(); igTextWrapped(member->blurb); @@ -161,7 +161,7 @@ static int config_render(void * udata, bool interactive, struct Rect * windowRec (ImVec2){550, 680}, ImGuiCond_FirstUseEver); - igPushIDInt(id++); + igPushID_Int(id++); if (!igBegin("Configuration", NULL, 0)) { overlayGetImGuiRect(windowRects); @@ -184,10 +184,10 @@ static int config_render(void * udata, bool interactive, struct Rect * windowRec { for (ll_reset(cfg.callbacks); ll_walk(cfg.callbacks, (void **)&cb); ) { - if (!igCollapsingHeaderBoolPtr(cb->title, NULL, 0)) + if (!igCollapsingHeader_BoolPtr(cb->title, NULL, 0)) continue; - igPushIDInt(id++); + igPushID_Int(id++); cb->callback(cb->udata, &id); igPopID(); } @@ -199,7 +199,7 @@ static int config_render(void * udata, bool interactive, struct Rect * windowRec if (!igBeginTabItem(cb->title, NULL, 0)) continue; - igPushIDInt(id++); + igPushID_Int(id++); cb->callback(cb->udata, &id); igPopID(); igEndTabItem(); diff --git a/client/src/overlay/fps.c b/client/src/overlay/fps.c index c27640a4..2aff484d 100644 --- a/client/src/overlay/fps.c +++ b/client/src/overlay/fps.c @@ -71,8 +71,8 @@ static int fps_render(void * udata, bool interactive, struct Rect * windowRects, ImVec2 pos = {0.0f, 0.0f}; igSetNextWindowBgAlpha(0.6f); igSetNextWindowPos(pos, ImGuiCond_FirstUseEver, pos); - igPushStyleVarVec2(ImGuiStyleVar_WindowPadding, (ImVec2) { 4.0f , 4.0f }); - igPushStyleVarVec2(ImGuiStyleVar_WindowMinSize, (ImVec2) { 0.0f , 0.0f }); + igPushStyleVar_Vec2(ImGuiStyleVar_WindowPadding, (ImVec2) { 4.0f , 4.0f }); + igPushStyleVar_Vec2(ImGuiStyleVar_WindowMinSize, (ImVec2) { 0.0f , 0.0f }); igBegin( "FPS", diff --git a/client/src/overlay/graphs.c b/client/src/overlay/graphs.c index f3735c57..65d40052 100644 --- a/client/src/overlay/graphs.c +++ b/client/src/overlay/graphs.c @@ -171,7 +171,7 @@ static int graphs_render(void * udata, bool interactive, "%s: min:%4.2f max:%4.2f avg:%4.2f/%4.2fHz", graph->name, metrics.min, metrics.max, metrics.avg, metrics.freq); - igPlotLinesFloatPtr( + igPlotLines_FloatPtr( "", (float *)ringbuffer_getValues(graph->buffer), ringbuffer_getLength(graph->buffer), diff --git a/client/src/overlay_utils.c b/client/src/overlay_utils.c index ba204669..d0c14a67 100644 --- a/client/src/overlay_utils.c +++ b/client/src/overlay_utils.c @@ -62,7 +62,8 @@ void overlayTextURL(const char * url, const char * text) { if (igIsItemClicked(ImGuiMouseButton_Left)) lgOpenURL(url); - overlayAddUnderline(igGetColorU32Vec4(*igGetStyleColorVec4(ImGuiCol_ButtonHovered))); + overlayAddUnderline(igGetColorU32_Vec4( + *igGetStyleColorVec4(ImGuiCol_ButtonHovered))); igSetMouseCursor(ImGuiMouseCursor_Hand); igSetTooltip("Open in browser: %s", url); } diff --git a/repos/cimgui b/repos/cimgui index 83f729b0..afce8528 160000 --- a/repos/cimgui +++ b/repos/cimgui @@ -1 +1 @@ -Subproject commit 83f729b09313749a56948604c4bc13492ac47e00 +Subproject commit afce852875e36e948951d6253963cea46101c17c