MCPcopy Create free account
hub / github.com/JeanPhilippeKernel/RendererEngine / Render

Method Render

ZEngine/src/ImguiLayer.cpp:103–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101 }
102
103 void ImguiLayer::Render() {
104 ImGui_ImplOpenGL3_NewFrame();
105#ifdef ZENGINE_WINDOW_SDL
106 ImGui_ImplSDL2_NewFrame(static_cast<SDL_Window*>(m_window.lock()->GetNativeWindow()));
107#else
108 ImGui_ImplGlfw_NewFrame();
109#endif
110
111 ImGui::NewFrame();
112 for (const auto& component : m_ui_components) {
113 if (component->GetVisibility() == true) {
114 component->Render();
115 }
116 }
117
118 ImGui::Render();
119 ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
120
121 ImGuiIO& io = ImGui::GetIO();
122 if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable) {
123#ifdef ZENGINE_WINDOW_SDL
124 SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow();
125 SDL_GLContext backup_current_context = SDL_GL_GetCurrentContext();
126#else
127 GLFWwindow* backup_current_context = static_cast<GLFWwindow*>(m_window.lock()->GetNativeContext());
128#endif
129 ImGui::UpdatePlatformWindows();
130 ImGui::RenderPlatformWindowsDefault();
131
132#ifdef ZENGINE_WINDOW_SDL
133 SDL_GL_MakeCurrent(backup_current_window, backup_current_context);
134#else
135 glfwMakeContextCurrent(backup_current_context);
136#endif
137 }
138 }
139
140 bool ImguiLayer::OnKeyPressed(Event::KeyPressedEvent& e) {
141 ImGuiIO& io = ImGui::GetIO();

Callers

nothing calls this directly

Calls 3

GetVisibilityMethod · 0.80
GetNativeWindowMethod · 0.45
GetNativeContextMethod · 0.45

Tested by

no test coverage detected