MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / onDrawImgui

Method onDrawImgui

Source/LevelDebugLayer.cpp:163–250  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163void LevelDebugLayer::onDrawImgui()
164{
165 if (_showDebugMenu)
166 return;
167
168 static int monitorN = 0;
169 static bool fullscreen;
170 static float gameSpeed, fps;
171 ImGui::SetNextWindowPos({1000.0f, 200.0f}, ImGuiCond_FirstUseEver);
172
173 ImGui::Begin("LeveDebugLayer Debug");
174
175#ifdef AX_PLATFORM_PC
176 if (ImGui::Checkbox("Fullscreen", &fullscreen))
177 {
178 int a;
179 auto monitor = glfwGetMonitors(&a)[monitorN];
180 auto mode = glfwGetVideoMode(monitor);
181
182 if (fullscreen)
183 glfwSetWindowMonitor(static_cast<GLViewImpl*>(ax::Director::getInstance()->getGLView())->getWindow(),
184 monitor, 0, 0, mode->width, mode->height, mode->refreshRate);
185 else
186 {
187 glfwSetWindowMonitor(static_cast<GLViewImpl*>(ax::Director::getInstance()->getGLView())->getWindow(),
188 NULL, 0, 0, 1280, 720, 0);
189 glfwWindowHint(GLFW_DECORATED, true);
190 }
191 }
192#endif
193
194 ImGui::SameLine();
195
196 if (ImGui::ArrowButton("full", ImGuiDir_Right))
197 ImGui::OpenPopup("Fullscreen Settings");
198
199 if (ImGui::BeginPopupModal("Fullscreen Settings", NULL, ImGuiWindowFlags_AlwaysAutoResize))
200 {
201 ImGui::InputInt("Monitor", &monitorN);
202 if (ImGui::Button("Close"))
203 ImGui::CloseCurrentPopup();
204 ImGui::EndPopup();
205 }
206
207 if (ImGui::Button("Exit"))
208 {
209 this->exit();
210 }
211
212 ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate,
213 ImGui::GetIO().Framerate);
214
215 if (ImGui::InputFloat("Speed", &gameSpeed))
216 Director::getInstance()->getScheduler()->setTimeScale(gameSpeed);
217
218 if (ImGui::InputFloat("FPS", &fps))
219 Director::getInstance()->setAnimationInterval(1.0f / fps);
220

Callers

nothing calls this directly

Calls 2

exitMethod · 0.95
sizeMethod · 0.80

Tested by

no test coverage detected