| 597 | } |
| 598 | |
| 599 | void TestbedApplication::keyboard_event(int key, int scancode, int action, int modifiers) { |
| 600 | |
| 601 | mGui.onKeyboardEvent(key, scancode, action, modifiers); |
| 602 | |
| 603 | // Close application on escape key |
| 604 | if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS) { |
| 605 | glfwSetWindowShouldClose(mWindow, GL_TRUE); |
| 606 | return; |
| 607 | } |
| 608 | |
| 609 | // Show/hide the GUI with "i" key |
| 610 | if (key == GLFW_KEY_I && action == GLFW_PRESS) { |
| 611 | mGui.setIsDisplayed(!mGui.getIsDisplayed()); |
| 612 | return; |
| 613 | } |
| 614 | |
| 615 | // Start/Stop camera rotation animation with "r" key |
| 616 | if (key == GLFW_KEY_R && action == GLFW_PRESS) { |
| 617 | mCurrentScene->setIsCameraRotationAnimationEnabled(!mCurrentScene->getIsCameraRotationAnimationEnabled()); |
| 618 | return; |
| 619 | } |
| 620 | |
| 621 | // Pause the application on "p" key |
| 622 | if (key == GLFW_KEY_P && action == GLFW_PRESS) { |
| 623 | |
| 624 | if (mTimer.isRunning()) { |
| 625 | pauseSimulation(); |
| 626 | } |
| 627 | else { |
| 628 | playSimulation(); |
| 629 | } |
| 630 | |
| 631 | return; |
| 632 | } |
| 633 | |
| 634 | mCurrentScene->keyboardEvent(key, scancode, action, modifiers); |
| 635 | } |
| 636 | |
| 637 | // Handle a mouse button event (default implementation: propagate to children) |
| 638 | void TestbedApplication::mouse_button_event(int button, int action, int modifiers) { |
no test coverage detected