[client] imgui: update to cimgui 1.86

This commit is contained in:
Geoffrey McRae 2022-01-08 00:26:12 +11:00
parent 8e8d8834de
commit ec0bd6adc8
11 changed files with 32 additions and 26 deletions

View File

@ -228,7 +228,8 @@ void egl_desktopConfigUI(EGL_Desktop * desktop)
for (int i = 0; i < EGL_SCALE_MAX; ++i) for (int i = 0; i < EGL_SCALE_MAX; ++i)
{ {
bool selected = i == desktop->scaleAlgo; 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; desktop->scaleAlgo = i;
if (selected) if (selected)
igSetItemDefaultFocus(); igSetItemDefaultFocus();

View File

@ -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 // this is needed to refresh the font atlas texture
ImGui_ImplOpenGL3_Shutdown(); ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplOpenGL3_Init("#version 300 es");
ImGui_ImplOpenGL3_NewFrame(); ImGui_ImplOpenGL3_NewFrame();
egl_damageResize(this->damage, this->translateX, this->translateY, this->scaleX, this->scaleY); egl_damageResize(this->damage, this->translateX, this->translateY, this->scaleX, this->scaleY);

View File

@ -268,7 +268,7 @@ static bool egl_filterDownscaleImguiConfig(EGL_Filter * filter)
for (int i = 0; i < DOWNSCALE_COUNT; ++i) for (int i = 0; i < DOWNSCALE_COUNT; ++i)
{ {
bool selected = i == this->filter; 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; redraw = true;
this->filter = i; this->filter = i;

View File

@ -334,7 +334,8 @@ static bool presetsUI(struct EGL_PostProcess * this)
for (unsigned i = 0; i < stringlist_count(this->presets); ++i) for (unsigned i = 0; i < stringlist_count(this->presets); ++i)
{ {
bool selected = i == this->activePreset; 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; this->activePreset = i;
redraw = true; redraw = true;
@ -365,7 +366,7 @@ static bool presetsUI(struct EGL_PostProcess * this)
if (igButton("Save preset as...", (ImVec2) { 0.0f, 0.0f })) if (igButton("Save preset as...", (ImVec2) { 0.0f, 0.0f }))
{ {
this->presetEdit[0] = '\0'; this->presetEdit[0] = '\0';
igOpenPopup("Save preset as...", ImGuiPopupFlags_None); igOpenPopup_Str("Save preset as...", ImGuiPopupFlags_None);
} }
igSameLine(0.0f, -1.0f); igSameLine(0.0f, -1.0f);
@ -401,7 +402,7 @@ static bool presetsUI(struct EGL_PostProcess * this)
} }
if (this->presetError) if (this->presetError)
igOpenPopup("Preset error", ImGuiPopupFlags_None); igOpenPopup_Str("Preset error", ImGuiPopupFlags_None);
if (igBeginPopupModal("Preset error", NULL, ImGuiWindowFlags_AlwaysAutoResize)) if (igBeginPopupModal("Preset error", NULL, ImGuiWindowFlags_AlwaysAutoResize))
{ {
@ -425,7 +426,7 @@ static bool presetsUI(struct EGL_PostProcess * this)
static void drawDropTarget(void) 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(); igSeparator();
igPopStyleColor(1); igPopStyleColor(1);
} }
@ -456,8 +457,8 @@ static void configUI(void * opaque, int * id)
if (moving && mouseIdx < moveIdx && i == mouseIdx) if (moving && mouseIdx < moveIdx && i == mouseIdx)
drawDropTarget(); drawDropTarget();
igPushIDPtr(filter); igPushID_Ptr(filter);
bool draw = igCollapsingHeaderBoolPtr(filter->ops.name, NULL, 0); bool draw = igCollapsingHeader_BoolPtr(filter->ops.name, NULL, 0);
if (igIsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem)) if (igIsItemHovered(ImGuiHoveredFlags_AllowWhenBlockedByActiveItem))
mouseIdx = i; mouseIdx = i;

View File

@ -808,8 +808,10 @@ int app_renderOverlay(struct Rect * rects, int maxRects)
if (g_state.overlayInput) if (g_state.overlayInput)
{ {
totalDamage = true; totalDamage = true;
ImDrawList_AddRectFilled(igGetBackgroundDrawListNil(), (ImVec2) { 0.0f , 0.0f }, ImDrawList_AddRectFilled(igGetBackgroundDrawList_Nil(), (ImVec2) { 0.0f , 0.0f },
g_state.io->DisplaySize, igGetColorU32Col(ImGuiCol_ModalWindowDimBg, 1.0f), 0, 0); g_state.io->DisplaySize,
igGetColorU32_Col(ImGuiCol_ModalWindowDimBg, 1.0f),
0, 0);
// bool test; // bool test;
// igShowDemoWindow(&test); // igShowDemoWindow(&test);

View File

@ -51,9 +51,9 @@ static int alert_render(void * udata, bool interactive, struct Rect * windowRect
igSetNextWindowBgAlpha(0.8f); igSetNextWindowBgAlpha(0.8f);
igSetNextWindowPos((ImVec2) { screen->x / 2.0f, screen->y / 2.0f }, 0, igSetNextWindowPos((ImVec2) { screen->x / 2.0f, screen->y / 2.0f }, 0,
(ImVec2) { 0.5f, 0.5f }); (ImVec2) { 0.5f, 0.5f });
igPushStyleColorU32(ImGuiCol_WindowBg, colours[g_state.alertType]); igPushStyleColor_U32(ImGuiCol_WindowBg, colours[g_state.alertType]);
igPushStyleVarVec2(ImGuiStyleVar_WindowPadding, (ImVec2) { 4.0f , 4.0f }); igPushStyleVar_Vec2(ImGuiStyleVar_WindowPadding, (ImVec2) { 4.0f , 4.0f });
igPushStyleVarVec2(ImGuiStyleVar_WindowMinSize, (ImVec2) { 0.0f , 0.0f }); igPushStyleVar_Vec2(ImGuiStyleVar_WindowMinSize, (ImVec2) { 0.0f , 0.0f });
igBegin( igBegin(
"Alert", "Alert",

View File

@ -78,7 +78,7 @@ static void config_renderLGTab(void)
{ {
const float fontSize = igGetFontSize(); const float fontSize = igGetFontSize();
if (igCollapsingHeaderBoolPtr("About", NULL, if (igCollapsingHeader_BoolPtr("About", NULL,
ImGuiTreeNodeFlags_DefaultOpen)) ImGuiTreeNodeFlags_DefaultOpen))
{ {
igText(LG_COPYRIGHT_STR); igText(LG_COPYRIGHT_STR);
@ -88,7 +88,7 @@ static void config_renderLGTab(void)
igTextWrapped(LG_LICENSE_STR); igTextWrapped(LG_LICENSE_STR);
} }
if (igCollapsingHeaderBoolPtr("Help & Support", NULL, if (igCollapsingHeader_BoolPtr("Help & Support", NULL,
ImGuiTreeNodeFlags_DefaultOpen)) ImGuiTreeNodeFlags_DefaultOpen))
{ {
igBeginTable("split", 2, 0, (ImVec2){}, 0.0f); igBeginTable("split", 2, 0, (ImVec2){}, 0.0f);
@ -103,12 +103,12 @@ static void config_renderLGTab(void)
igEndTable(); igEndTable();
} }
if (igCollapsingHeaderBoolPtr("The Looking Glass Team / Donations", NULL, if (igCollapsingHeader_BoolPtr("The Looking Glass Team / Donations", NULL,
ImGuiTreeNodeFlags_DefaultOpen)) ImGuiTreeNodeFlags_DefaultOpen))
{ {
for(const struct LGTeamMember * member = LG_TEAM; member->name; ++member) for(const struct LGTeamMember * member = LG_TEAM; member->name; ++member)
{ {
if (igTreeNodeStr(member->name)) if (igTreeNode_Str(member->name))
{ {
igSpacing(); igSpacing();
igTextWrapped(member->blurb); igTextWrapped(member->blurb);
@ -161,7 +161,7 @@ static int config_render(void * udata, bool interactive, struct Rect * windowRec
(ImVec2){550, 680}, (ImVec2){550, 680},
ImGuiCond_FirstUseEver); ImGuiCond_FirstUseEver);
igPushIDInt(id++); igPushID_Int(id++);
if (!igBegin("Configuration", NULL, 0)) if (!igBegin("Configuration", NULL, 0))
{ {
overlayGetImGuiRect(windowRects); 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); ) 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; continue;
igPushIDInt(id++); igPushID_Int(id++);
cb->callback(cb->udata, &id); cb->callback(cb->udata, &id);
igPopID(); igPopID();
} }
@ -199,7 +199,7 @@ static int config_render(void * udata, bool interactive, struct Rect * windowRec
if (!igBeginTabItem(cb->title, NULL, 0)) if (!igBeginTabItem(cb->title, NULL, 0))
continue; continue;
igPushIDInt(id++); igPushID_Int(id++);
cb->callback(cb->udata, &id); cb->callback(cb->udata, &id);
igPopID(); igPopID();
igEndTabItem(); igEndTabItem();

View File

@ -71,8 +71,8 @@ static int fps_render(void * udata, bool interactive, struct Rect * windowRects,
ImVec2 pos = {0.0f, 0.0f}; ImVec2 pos = {0.0f, 0.0f};
igSetNextWindowBgAlpha(0.6f); igSetNextWindowBgAlpha(0.6f);
igSetNextWindowPos(pos, ImGuiCond_FirstUseEver, pos); igSetNextWindowPos(pos, ImGuiCond_FirstUseEver, pos);
igPushStyleVarVec2(ImGuiStyleVar_WindowPadding, (ImVec2) { 4.0f , 4.0f }); igPushStyleVar_Vec2(ImGuiStyleVar_WindowPadding, (ImVec2) { 4.0f , 4.0f });
igPushStyleVarVec2(ImGuiStyleVar_WindowMinSize, (ImVec2) { 0.0f , 0.0f }); igPushStyleVar_Vec2(ImGuiStyleVar_WindowMinSize, (ImVec2) { 0.0f , 0.0f });
igBegin( igBegin(
"FPS", "FPS",

View File

@ -171,7 +171,7 @@ static int graphs_render(void * udata, bool interactive,
"%s: min:%4.2f max:%4.2f avg:%4.2f/%4.2fHz", "%s: min:%4.2f max:%4.2f avg:%4.2f/%4.2fHz",
graph->name, metrics.min, metrics.max, metrics.avg, metrics.freq); graph->name, metrics.min, metrics.max, metrics.avg, metrics.freq);
igPlotLinesFloatPtr( igPlotLines_FloatPtr(
"", "",
(float *)ringbuffer_getValues(graph->buffer), (float *)ringbuffer_getValues(graph->buffer),
ringbuffer_getLength(graph->buffer), ringbuffer_getLength(graph->buffer),

View File

@ -62,7 +62,8 @@ void overlayTextURL(const char * url, const char * text)
{ {
if (igIsItemClicked(ImGuiMouseButton_Left)) if (igIsItemClicked(ImGuiMouseButton_Left))
lgOpenURL(url); lgOpenURL(url);
overlayAddUnderline(igGetColorU32Vec4(*igGetStyleColorVec4(ImGuiCol_ButtonHovered))); overlayAddUnderline(igGetColorU32_Vec4(
*igGetStyleColorVec4(ImGuiCol_ButtonHovered)));
igSetMouseCursor(ImGuiMouseCursor_Hand); igSetMouseCursor(ImGuiMouseCursor_Hand);
igSetTooltip("Open in browser: %s", url); igSetTooltip("Open in browser: %s", url);
} }

@ -1 +1 @@
Subproject commit 83f729b09313749a56948604c4bc13492ac47e00 Subproject commit afce852875e36e948951d6253963cea46101c17c