MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / pushWindow

Method pushWindow

Source/Falcor/Utils/UI/Gui.cpp:507–545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507bool GuiImpl::pushWindow(const char label[], bool& open, uint2 size, uint2 pos, Gui::WindowFlags flags)
508{
509 bool allowClose = is_set(flags, Gui::WindowFlags::CloseButton);
510 if (allowClose)
511 {
512 if (!is_set(flags, Gui::WindowFlags::ShowTitleBar))
513 {
514 logWarning(
515 "Asking for a close button on window '{}' but the ShowTitleBar flag is not set on the window. The window will not be able "
516 "to display a close button.",
517 label
518 );
519 }
520 }
521
522 ImVec2 fPos(pos.x * mScaleFactor, pos.y * mScaleFactor);
523 ImVec2 fSize(size.x * mScaleFactor, size.y * mScaleFactor);
524 ImGui::SetNextWindowSize(fSize, ImGuiCond_FirstUseEver);
525 ImGui::SetNextWindowPos(fPos, ImGuiCond_FirstUseEver);
526 int imguiFlags = 0;
527 if (!is_set(flags, Gui::WindowFlags::ShowTitleBar))
528 imguiFlags |= ImGuiWindowFlags_NoTitleBar;
529 if (!is_set(flags, Gui::WindowFlags::AllowMove))
530 imguiFlags |= ImGuiWindowFlags_NoMove;
531 if (!is_set(flags, Gui::WindowFlags::SetFocus))
532 imguiFlags |= ImGuiWindowFlags_NoFocusOnAppearing;
533 if (is_set(flags, Gui::WindowFlags::NoResize))
534 imguiFlags |= ImGuiWindowFlags_NoResize;
535 if (is_set(flags, Gui::WindowFlags::AutoResize))
536 imguiFlags |= ImGuiWindowFlags_AlwaysAutoResize;
537
538 ImGui::Begin(label, allowClose ? &open : nullptr, imguiFlags);
539
540 if (!open)
541 ImGui::End();
542 else
543 ImGui::PushFont(mpActiveFont);
544 return open;
545}
546
547void GuiImpl::popWindow()
548{

Callers 1

WindowMethod · 0.80

Calls 1

logWarningFunction · 0.50

Tested by

no test coverage detected