MCPcopy Create free account
hub / github.com/SFML/imgui-sfml / Shutdown

Function Shutdown

imgui-SFML.cpp:588–618  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586}
587
588void Shutdown(const sf::Window& window)
589{
590 const bool needReplacement = (s_currWindowCtx->window->getNativeHandle() == window.getNativeHandle());
591
592 // remove window's context
593 auto found = std::find_if(s_windowContexts.begin(),
594 s_windowContexts.end(),
595 [&](std::unique_ptr<WindowContext>& ctx)
596 { return ctx->window->getNativeHandle() == window.getNativeHandle(); });
597 assert(found != s_windowContexts.end() &&
598 "Window wasn't inited properly: forgot to call ImGui::SFML::Init(window)?");
599 s_windowContexts.erase(found); // s_currWindowCtx can become invalid here!
600
601 // set current context to some window for convenience if needed
602 if (needReplacement)
603 {
604 auto it = s_windowContexts.begin();
605 if (it != s_windowContexts.end())
606 {
607 // set to some other window
608 s_currWindowCtx = it->get();
609 ImGui::SetCurrentContext(s_currWindowCtx->imContext);
610 }
611 else
612 {
613 // no alternatives...
614 s_currWindowCtx = nullptr;
615 ImGui::SetCurrentContext(nullptr);
616 }
617 }
618}
619
620void Shutdown()
621{

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected