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

Method mouseMotionEvent

testbed/src/Scene.cpp:110–138  ·  view source on GitHub ↗

Called when a mouse motion event occurs

Source from the content-addressed store, hash-verified

108
109// Called when a mouse motion event occurs
110bool Scene::mouseMotionEvent(double xMouse, double yMouse, int leftButtonState,
111 int rightButtonState, int middleButtonState,
112 int altKeyState) {
113
114 // Zoom
115 if (leftButtonState == GLFW_PRESS && altKeyState == GLFW_PRESS) {
116
117 float dy = static_cast<float>(yMouse - mLastMouseY);
118 float h = static_cast<float>(mWindowHeight);
119
120 // Zoom the camera
121 zoom(-dy / h);
122 }
123 // Translation
124 else if (middleButtonState == GLFW_PRESS || rightButtonState == GLFW_PRESS ||
125 (leftButtonState == GLFW_PRESS && altKeyState == GLFW_PRESS)) {
126 translate(xMouse, yMouse);
127 }
128 // Rotation
129 else if (leftButtonState == GLFW_PRESS) {
130 rotate(xMouse, yMouse);
131 }
132
133 // Remember the mouse position
134 mLastMouseX = xMouse;
135 mLastMouseY = yMouse;
136
137 return true;
138}
139
140// Called when a scrolling event occurs
141bool Scene::scrollingEvent(float /*xAxis*/, float yAxis, float scrollSensitivy) {

Callers 1

mouse_motion_eventMethod · 0.45

Calls

no outgoing calls

Tested by 1

mouse_motion_eventMethod · 0.36