diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-08-16 15:36:17 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-08-16 15:36:17 +0200 |
| commit | 50848b2dd97093dd407ed7199118bca011f1aa4c (patch) | |
| tree | 176a0aa8a1ce966123a56e0988511f6ddfcd42eb /src/ui/helpers.cpp | |
| parent | b2a5ae0b5b628cca712bb80d485393800de34172 (diff) | |
more refactor work
Diffstat (limited to 'src/ui/helpers.cpp')
| -rw-r--r-- | src/ui/helpers.cpp | 42 |
1 files changed, 3 insertions, 39 deletions
diff --git a/src/ui/helpers.cpp b/src/ui/helpers.cpp index 0cce207..7bde384 100644 --- a/src/ui/helpers.cpp +++ b/src/ui/helpers.cpp @@ -3,43 +3,6 @@ #include "locales.hpp" #include "strops.hpp" -static float toast_timer = 0.0f; -static const char* toast_msg = nullptr; -void ui_helper_show_toast(const char* msg) -{ - toast_msg = msg; - toast_timer = 3.0f; -} - -void ui_helper_draw_toasts() -{ - if (toast_timer > 0.0f && toast_msg) - { - toast_timer -= ImGui::GetIO().DeltaTime; - - const float pad = 10.0f; - const ImVec2 window_pos = ImVec2( - ImGui::GetIO().DisplaySize.x - pad, - ImGui::GetIO().DisplaySize.y - pad - ); - const ImVec2 window_pos_pivot = ImVec2(1.0f, 1.0f); - - ImGui::SetNextWindowPos(window_pos, ImGuiCond_Always, window_pos_pivot); - ImGui::SetNextWindowBgAlpha(0.85f); // semi-transparent - - ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | - ImGuiWindowFlags_AlwaysAutoResize | - ImGuiWindowFlags_NoFocusOnAppearing | - ImGuiWindowFlags_NoNav; - - if (ImGui::Begin("##Toast", nullptr, flags)) - { - ImGui::TextUnformatted(toast_msg); - } - ImGui::End(); - } -} - void ui_helper_draw_required_tag() { ImDrawList* draw_list = ImGui::GetWindowDrawList(); @@ -65,7 +28,7 @@ void ui_helper_draw_required_tag() ImGui::PopStyleColor(); } -int ui_helper_TextInputWithAutocomplete(const char* label, const char* hint, char* buffer, size_t buf_size, +int TextInputWithAutocomplete(const char* label, const char* hint, char* buffer, size_t buf_size, char* suggestions[], int suggestion_count) { int result = -1; @@ -110,4 +73,5 @@ int ui_helper_TextInputWithAutocomplete(const char* label, const char* hint, cha } } return result; -}
\ No newline at end of file +} + |
