diff options
author | rtk0c <[email protected]> | 2022-11-27 12:04:31 -0800 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-11-27 12:04:31 -0800 |
commit | 182c8f8357739f905bbd721006480502435b6b43 (patch) | |
tree | 082613a474d863182e2ad8f2167f1643f26e67a3 /app/source/Cplt/UI/UI_Utils.cpp | |
parent | b01ed99a1cd0c863c8709930658513c04dd70f61 (diff) |
Update brace style to match rest of my projectscplt-imgui
Diffstat (limited to 'app/source/Cplt/UI/UI_Utils.cpp')
-rw-r--r-- | app/source/Cplt/UI/UI_Utils.cpp | 43 |
1 files changed, 15 insertions, 28 deletions
diff --git a/app/source/Cplt/UI/UI_Utils.cpp b/app/source/Cplt/UI/UI_Utils.cpp index a2bf692..9fd645d 100644 --- a/app/source/Cplt/UI/UI_Utils.cpp +++ b/app/source/Cplt/UI/UI_Utils.cpp @@ -6,37 +6,31 @@ #define IMGUI_DEFINE_MATH_OPERATORS #include <imgui_internal.h> -void ImGui::SetNextWindowSizeRelScreen(float xPercent, float yPercent, ImGuiCond cond) -{ +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) -{ +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() -{ +void ImGui::PushDisabled() { ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); ImGui::PushStyleVar(ImGuiStyleVar_Alpha, 0.5f * ImGui::GetStyle().Alpha); } -void ImGui::PopDisabled() -{ +void ImGui::PopDisabled() { ImGui::PopItemFlag(); ImGui::PopStyleVar(); } -bool ImGui::Button(const char* label, bool disabled) -{ +bool ImGui::Button(const char* label, bool disabled) { return Button(label, ImVec2{}, disabled); } -bool ImGui::Button(const char* label, const ImVec2& sizeArg, bool disabled) -{ +bool ImGui::Button(const char* label, const ImVec2& sizeArg, bool disabled) { if (disabled) PushDisabled(); bool res = ImGui::Button(label, sizeArg); if (disabled) PopDisabled(); @@ -47,15 +41,13 @@ bool ImGui::Button(const char* label, const ImVec2& sizeArg, bool disabled) return res; } -void ImGui::ErrorIcon() -{ +void ImGui::ErrorIcon() { ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{ 237 / 255.0f, 67 / 255.0f, 55 / 255.0f, 1.0f }); // #ED4337 ImGui::Text(ICON_FA_EXCLAMATION_CIRCLE); ImGui::PopStyleColor(); } -void ImGui::ErrorMessage(const char* fmt, ...) -{ +void ImGui::ErrorMessage(const char* fmt, ...) { ErrorIcon(); SameLine(); @@ -65,15 +57,13 @@ void ImGui::ErrorMessage(const char* fmt, ...) va_end(args); } -void ImGui::WarningIcon() -{ +void ImGui::WarningIcon() { ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{ 255 / 255.0f, 184 / 255.0f, 24 / 255.0f, 1.0f }); // #FFB818 ImGui::Text(ICON_FA_EXCLAMATION_TRIANGLE); ImGui::PopStyleColor(); } -void ImGui::WarningMessage(const char* fmt, ...) -{ +void ImGui::WarningMessage(const char* fmt, ...) { WarningIcon(); SameLine(); @@ -83,8 +73,7 @@ void ImGui::WarningMessage(const char* fmt, ...) va_end(args); } -void ImGui::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2& b, IconType type, bool filled, ImU32 color, ImU32 innerColor) -{ +void ImGui::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2& b, IconType type, bool filled, ImU32 color, ImU32 innerColor) { // Taken from https://github.com/thedmd/imgui-node-editor/blob/master/examples/blueprints-example/utilities/drawing.cpp // ax::NodeEditor::DrawIcon @@ -109,7 +98,7 @@ void ImGui::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2& b, Ico const auto margin = 2.0f * origin_scale; const auto rounding = 0.1f * origin_scale; const auto tip_round = 0.7f; // percentage of triangle edge (for tip) - //const auto edge_round = 0.7f; // percentage of triangle edge (for corner) + // const auto edge_round = 0.7f; // percentage of triangle edge (for corner) const auto canvas = ImRect( rect.Min.x + margin + offset_x, rect.Min.y + margin + offset_y, @@ -125,7 +114,7 @@ void ImGui::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2& b, Ico const auto top = canvas_y + canvas_h * 0.5f * 0.2f; const auto bottom = canvas_y + canvas_h - canvas_h * 0.5f * 0.2f; const auto center_y = (top + bottom) * 0.5f; - //const auto angle = AX_PI * 0.5f * 0.5f * 0.5f; + // const auto angle = AX_PI * 0.5f * 0.5f * 0.5f; const auto tip_top = ImVec2(canvas_x + canvas_w * 0.5f, top); const auto tip_right = ImVec2(right, center_y); @@ -285,8 +274,7 @@ void ImGui::DrawIcon(ImDrawList* drawList, const ImVec2& a, const ImVec2& b, Ico } } -void ImGui::Icon(const ImVec2& size, IconType type, bool filled, const ImVec4& color, const ImVec4& innerColor) -{ +void ImGui::Icon(const ImVec2& size, IconType type, bool filled, const ImVec4& color, const ImVec4& innerColor) { // Taken from https://github.com/thedmd/imgui-node-editor/blob/master/examples/blueprints-example/utilities/widgets.cpp // ax::NodeEditor::Icon @@ -300,8 +288,7 @@ void ImGui::Icon(const ImVec2& size, IconType type, bool filled, const ImVec4& c ImGui::Dummy(size); } -bool ImGui::Splitter(bool splitVertically, float thickness, float* size1, float* size2, float minSize1, float minSize2, float splitterLongAxisSize) -{ +bool ImGui::Splitter(bool splitVertically, float thickness, float* size1, float* size2, float minSize1, float minSize2, float splitterLongAxisSize) { // Taken from https://github.com/thedmd/imgui-node-editor/blob/master/examples/blueprints-example/blueprints-example.cpp // ::Splitter |