diff --git a/src/dusk/imgui/ImGuiConsole.cpp b/src/dusk/imgui/ImGuiConsole.cpp index d83e68b4d8..e2dbbf47d4 100644 --- a/src/dusk/imgui/ImGuiConsole.cpp +++ b/src/dusk/imgui/ImGuiConsole.cpp @@ -61,10 +61,6 @@ namespace dusk { ImGui::TextUnformatted(text.data(), text.data() + text.size()); } - void DuskToast(std::string_view message, float duration) { - g_imguiConsole.AddToast(message, duration); - } - void ImGuiTextCenter(std::string_view text) { ImGui::NewLine(); float fontSize = ImGui::CalcTextSize( @@ -390,8 +386,6 @@ namespace dusk { SDL_HideCursor(); } } - - ShowToasts(); } void ImGuiConsole::PostDraw() { @@ -545,50 +539,6 @@ namespace dusk { return false; } - void ImGuiConsole::AddToast(std::string_view message, float duration) { - m_toasts.emplace_back(std::string(message), duration); - } - - void ImGuiConsole::ShowToasts() { - if (m_toasts.empty()) { - return; - } - auto& toast = m_toasts.front(); - const float dt = ImGui::GetIO().DeltaTime; - toast.remain -= dt; - toast.current += dt; - - const ImGuiViewport* viewport = ImGui::GetMainViewport(); - const ImVec2 workPos = viewport->WorkPos; - const ImVec2 workSize = viewport->WorkSize; - constexpr float padding = 10.0f; - const ImVec2 windowPos{workPos.x + workSize.x / 2, workPos.y + workSize.y - padding}; - ImGui::SetNextWindowPos(windowPos, ImGuiCond_Always, ImVec2{0.5f, 1.f}); - - const float alpha = std::min({toast.remain, toast.current, 1.f}); - ImGui::SetNextWindowBgAlpha(alpha * 0.65f); - ImVec4 textColor = ImGui::GetStyleColorVec4(ImGuiCol_Text); - textColor.w *= alpha; - ImVec4 borderColor = ImGui::GetStyleColorVec4(ImGuiCol_Border); - borderColor.w *= alpha; - ImGui::PushStyleColor(ImGuiCol_Text, textColor); - ImGui::PushStyleColor(ImGuiCol_Border, borderColor); - if (ImGui::Begin("Toast", nullptr, - ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize | - ImGuiWindowFlags_NoSavedSettings | - ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav | - ImGuiWindowFlags_NoMove)) - { - ImGuiStringViewText(toast.message); - } - ImGui::End(); - ImGui::PopStyleColor(2); - - if (toast.remain <= 0.f) { - m_toasts.pop_front(); - } - } - void ImGuiConsole::ShowPipelineProgress() { const auto* stats = aurora_get_stats(); const u32 queuedPipelines = stats->queuedPipelines; diff --git a/src/dusk/imgui/ImGuiConsole.hpp b/src/dusk/imgui/ImGuiConsole.hpp index c1adc427eb..bc9f253156 100644 --- a/src/dusk/imgui/ImGuiConsole.hpp +++ b/src/dusk/imgui/ImGuiConsole.hpp @@ -24,29 +24,18 @@ public: void PostDraw(); static bool CheckMenuViewToggle(ImGuiKey key, bool& active); - void AddToast(std::string_view message, float duration = 3.f); private: - struct Toast { - std::string message; - float remain; - float current = 0.f; - Toast(std::string message, float duration) noexcept : message(std::move(message)), - remain(duration) {} - }; - float mouseHideTimer = 0.0f; bool m_isHidden = true; bool m_isLaunchInitialized = false; ImGuiWindow* m_dragScrollWindow = nullptr; ImVec2 m_dragScrollLastMousePos = {}; - std::deque m_toasts; // Keep always last ImGuiMenuTools m_menuTools; - void ShowToasts(); void ShowPipelineProgress(); void UpdateDragScroll(); }; @@ -60,7 +49,6 @@ std::string BytesToString(size_t bytes); void SetOverlayWindowLocation(int corner); bool ShowCornerContextMenu(int& corner, int avoidCorner); void ImGuiStringViewText(std::string_view text); -void DuskToast(std::string_view message, float duration = 3.f); void ImGuiBeginGroupPanel(const char* name, const ImVec2& size); void ImGuiEndGroupPanel(); void ImGuiTextCenter(std::string_view text);