diff options
author | rtk0c <[email protected]> | 2021-03-30 19:40:11 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2021-03-30 19:40:11 -0700 |
commit | 31950890c939862f79c817053c106bf711c63a64 (patch) | |
tree | 4e02abf37d69ab7d4f988f143b340cfd3d93331c /core/src/UI/UI_Utils.cpp | |
parent | e75e26da92424528e190a2111acfcc49c657e894 (diff) |
Product items and misc stuff
Diffstat (limited to 'core/src/UI/UI_Utils.cpp')
-rw-r--r-- | core/src/UI/UI_Utils.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/core/src/UI/UI_Utils.cpp b/core/src/UI/UI_Utils.cpp index 61a62f0..615caae 100644 --- a/core/src/UI/UI_Utils.cpp +++ b/core/src/UI/UI_Utils.cpp @@ -2,6 +2,27 @@ #include <IconsFontAwesome.h> #include <imgui.h> +#include <imgui_internal.h> + +void ImGui::SetNextWindowSizeRelScreen(float xPercent, float yPercent, ImGuiCond_ cond) { + auto vs = ImGui::GetMainViewport()->Size; + ImGui::SetNextWindowSize({ vs.x * xPercent, vs.y * yPercent }, cond); +} + +void ImGui::SetNextWindowCentered(ImGuiCond_ cond) { + auto vs = ImGui::GetMainViewport()->Size; + ImGui::SetNextWindowPos({ vs.x / 2, vs.y / 2 }, cond, { 0.5f, 0.5f }); +} + +void ImGui::PushDisabled() { + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, false); + ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.5f * ImGui::GetStyle().Alpha); +} + +void ImGui::PopDisabled() { + ImGui::PopItemFlag(); + ImGui::PopStyleVar(); +} void ImGui::ErrorIcon() { ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{ 237 / 255.0f, 67 / 255.0f, 55 / 255.0f, 1.0f }); // #ED4337 |