MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / keyboard_event

Method keyboard_event

testbed/src/TestbedApplication.cpp:599–635  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

597}
598
599void 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)
638void TestbedApplication::mouse_button_event(int button, int action, int modifiers) {

Callers 1

startMethod · 0.80

Calls 7

onKeyboardEventMethod · 0.80
setIsDisplayedMethod · 0.80
getIsDisplayedMethod · 0.80
isRunningMethod · 0.80
keyboardEventMethod · 0.45

Tested by

no test coverage detected