MCPcopy Create free account
hub / github.com/MrDrElliot/LuminaEngine / Render

Function Render

Engine/Editor/Source/UI/SlowTaskModal.cpp:89–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, BarPaddingY));
88 ImGui::ProgressBar(Task.Fraction, ImVec2(-FLT_MIN, BarHeight), *Overlay);
89 ImGui::PopStyleVar(2);
90 ImGui::PopStyleColor(2);
91 }
92 }
93
94 void Render()
95 {
96 TVector<FSlowTaskProgress> Tasks = SlowTasks::GetSnapshot();
97
98 const bool bWantOpen = !Tasks.IsEmpty();
99 const bool bIsOpen = ImGui::IsPopupOpen(GPopupID);
100
101 if (bWantOpen && !bIsOpen)
102 {
103 ImGui::OpenPopup(GPopupID);
104 }
105
106 if (!bWantOpen)
107 {
108 // Drain the popup so it actually closes once every task has finished.
109 if (bIsOpen && ImGui::BeginPopupModal(GPopupID, nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize))
110 {
111 ImGui::CloseCurrentPopup();
112 ImGui::EndPopup();
113 }
114 return;
115 }
116
117 const ImGuiViewport* Viewport = ImGui::GetMainViewport();
118 ImGui::SetNextWindowPos(Viewport->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
119 ImGui::SetNextWindowSize(ImVec2(460.0f, 0.0f), ImGuiCond_Always);
120
121 constexpr ImGuiWindowFlags Flags =
122 ImGuiWindowFlags_NoTitleBar |
123 ImGuiWindowFlags_NoResize |
124 ImGuiWindowFlags_NoMove |
125 ImGuiWindowFlags_NoSavedSettings;
126
127 ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(20.0f, 18.0f));
128 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(6.0f, 6.0f));
129
130 if (ImGui::BeginPopupModal(GPopupID, nullptr, Flags))
131 {
132 ImGui::PushStyleColor(ImGuiCol_Text, GHeaderText);
133 ImGui::TextUnformatted(LE_ICON_TIMER_SAND " WORKING");
134 ImGui::PopStyleColor();
135 ImGui::Spacing();
136
137 for (int32 i = 0; i < Tasks.Num(); ++i)
138 {
139 if (i > 0)
140 {
141 ImGui::Spacing();
142 ImGui::Separator();
143 ImGui::Spacing();
144 }
145 DrawTask(Tasks[i]);
146 }

Callers

nothing calls this directly

Calls 12

GetSnapshotFunction · 0.85
PushStyleVarFunction · 0.85
PushStyleColorFunction · 0.85
TextUnformattedFunction · 0.85
PopStyleColorFunction · 0.85
SeparatorClass · 0.85
DrawTaskFunction · 0.85
PopStyleVarFunction · 0.85
ImVec2Function · 0.50
emptyMethod · 0.45
GetCenterMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected