diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-08-23 18:47:13 +0200 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2025-08-23 18:47:13 +0200 |
| commit | df9353ecbdadc5ff4efe42c242e233cacedea50b (patch) | |
| tree | c728dbf80b3c7067dbdaec42261673e697cf9ca6 /src/ui/helpers.cpp | |
| parent | 359422c97cce93bbb27051f9df3efb45bd0b9052 (diff) | |
file writing work
Diffstat (limited to 'src/ui/helpers.cpp')
| -rw-r--r-- | src/ui/helpers.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/ui/helpers.cpp b/src/ui/helpers.cpp index c15528e..37c4b36 100644 --- a/src/ui/helpers.cpp +++ b/src/ui/helpers.cpp @@ -11,8 +11,14 @@ void ui_draw_status() { float region_width = ImGui::GetContentRegionAvail().x; float text_width = ImGui::CalcTextSize(current_status.text).x; + + if (current_status.loading) + { + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + region_width - text_width - 20.0f); + ImGui::Text("%c", "|/-\\"[(int)(ImGui::GetTime() / 0.1f) & 3]); + return; + } - // Move cursor so that the text ends at the right edge if (current_status.visible) { ImGui::SetCursorPosX(ImGui::GetCursorPosX() + region_width - text_width); @@ -43,6 +49,7 @@ void ui_set_status_ex(const char* txt, int color) current_status.visible = true; current_status.time = 0.0f; current_status.color = color; + current_status.loading = false; strops_copy(current_status.text, txt, STATUS_TEXT_LEN); } @@ -56,6 +63,13 @@ void ui_set_status(const char* txt) ui_set_status_ex(txt, COLOR_DEFAULT); } +void ui_set_status_loading(bool loading) +{ + current_status.visible = true; + current_status.time = 0.0f; + current_status.loading = loading; +} + ui_status ui_get_status() { return current_status; @@ -134,4 +148,3 @@ int TextInputWithAutocomplete(const char* label, const char* hint, char* buffer, } return result; } - |
