MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / messageBoxUi

Function messageBoxUi

TheForceEngine/TFE_Editor/editor.cpp:258–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256 }
257
258 bool messageBoxUi()
259 {
260 bool finished = false;
261
262 pushFont(FONT_SMALL);
263 if (ImGui::BeginPopupModal(s_msgBox.id, nullptr, ImGuiWindowFlags_AlwaysAutoResize))
264 {
265 ImGuiStyle& style = ImGui::GetStyle();
266 f32 textWidth = ImGui::CalcTextSize(s_msgBox.msg).x + style.FramePadding.x;
267 f32 buttonWidth = ImGui::CalcTextSize("OK").x;
268
269 ImGui::Text("%s", s_msgBox.msg);
270 ImGui::Separator();
271
272 ImGui::SetCursorPosX(ImGui::GetCursorPosX() + (textWidth - buttonWidth) * 0.5f);
273 if (ImGui::Button("OK"))
274 {
275 finished = true;
276 }
277 ImGui::EndPopup();
278 }
279 popFont();
280 return finished;
281 }
282
283 bool isPopupOpen()
284 {

Callers 1

handlePopupEndFunction · 0.85

Calls 3

pushFontFunction · 0.85
ButtonEnum · 0.85
popFontFunction · 0.85

Tested by

no test coverage detected