| 367 | } |
| 368 | |
| 369 | void SampleApp::renderGlobalUI(Gui* pGui) |
| 370 | { |
| 371 | ImGui::TextUnformatted("Keyboard Shortcuts"); |
| 372 | ImGui::SameLine(); |
| 373 | ImGui::TextDisabled("(?)"); |
| 374 | if (ImGui::IsItemHovered()) |
| 375 | { |
| 376 | ImGui::BeginTooltip(); |
| 377 | ImGui::PushTextWrapPos(450.0f); |
| 378 | ImGui::TextUnformatted(getKeyboardShortcutsStr().c_str()); |
| 379 | ImGui::PopTextWrapPos(); |
| 380 | ImGui::EndTooltip(); |
| 381 | } |
| 382 | |
| 383 | auto controlsGroup = Gui::Group(pGui, "Global Controls"); |
| 384 | if (controlsGroup.open()) |
| 385 | { |
| 386 | float t = (float)mClock.getTime(); |
| 387 | if (controlsGroup.var("Time", t, 0.f, FLT_MAX)) |
| 388 | mClock.setTime(double(t)); |
| 389 | if (controlsGroup.button("Reset")) |
| 390 | mClock.setTime(0.0); |
| 391 | bool timePaused = mClock.isPaused(); |
| 392 | if (controlsGroup.button(timePaused ? "Play" : "Pause", true)) |
| 393 | timePaused ? mClock.play() : mClock.pause(); |
| 394 | if (controlsGroup.button("Stop", true)) |
| 395 | mClock.stop(); |
| 396 | |
| 397 | float scale = (float)mClock.getTimeScale(); |
| 398 | if (controlsGroup.var("Scale", scale, 0.f, FLT_MAX)) |
| 399 | mClock.setTimeScale(scale); |
| 400 | controlsGroup.separator(); |
| 401 | |
| 402 | if (controlsGroup.button(mRendererPaused ? "Resume Rendering" : "Pause Rendering")) |
| 403 | mRendererPaused = !mRendererPaused; |
| 404 | controlsGroup.tooltip( |
| 405 | "Freeze the renderer and keep displaying the last rendered frame. The renderer will keep accepting mouse/keyboard/GUI " |
| 406 | "messages. Changes in the UI will not be reflected in the displayed image until the renderer is unfrozen" |
| 407 | ); |
| 408 | |
| 409 | controlsGroup.separator(); |
| 410 | uint2 screenDims = mpWindow->getClientAreaSize(); |
| 411 | if (screenSizeUI(controlsGroup, screenDims)) |
| 412 | resizeFrameBuffer(screenDims.x, screenDims.y); |
| 413 | |
| 414 | controlsGroup.separator(); |
| 415 | |
| 416 | mCaptureScreen = controlsGroup.button("Screen Capture"); |
| 417 | if (controlsGroup.button("Save Config")) |
| 418 | saveConfigToFile(); |
| 419 | |
| 420 | controlsGroup.release(); |
| 421 | } |
| 422 | } |
| 423 | |
| 424 | void SampleApp::renderUI() |
| 425 | { |