MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/FleX / MouseMotionFunc

Function MouseMotionFunc

demo/main.cpp:2531–2547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2529}
2530
2531void MouseMotionFunc(unsigned state, int x, int y)
2532{
2533 float dx = float(x - g_lastx);
2534 float dy = float(y - g_lasty);
2535
2536 g_lastx = x;
2537 g_lasty = y;
2538
2539 if (state & SDL_BUTTON_RMASK)
2540 {
2541 const float kSensitivity = DegToRad(0.1f);
2542 const float kMaxDelta = FLT_MAX;
2543
2544 g_camAngle.x -= Clamp(dx*kSensitivity, -kMaxDelta, kMaxDelta);
2545 g_camAngle.y -= Clamp(dy*kSensitivity, -kMaxDelta, kMaxDelta);
2546 }
2547}
2548
2549bool g_Error = false;
2550

Callers 1

SDLMainLoopFunction · 0.85

Calls 2

DegToRadFunction · 0.85
ClampFunction · 0.50

Tested by

no test coverage detected