DX11Starter/Game.cpp
// --------------------------------------------------------
// Helper method for mouse movement.  We only get this message
// if the mouse is currently over the window, or if we're 
// currently capturing the mouse.
// --------------------------------------------------------
Helper method for mouse movement.  We only get this message
if the mouse is currently over the window, or if we're
currently capturing the mouse.
Helper method for mouse movement . We only get this message if the mouse is currently over the window or if we ' re currently capturing the mouse .
void Game::OnMouseMove(WPARAM buttonState, int x, int y)
{
	if (mouseDragging) {
		float rotateSpeed = 0.005f;
		camera->Rotate((y - prevMousePos.y) * rotateSpeed, (x - prevMousePos.x) * rotateSpeed);
	}
	prevMousePos.x = x;
	prevMousePos.y = y;
}
void Game :: OnMouseMove ( WPARAM buttonState , int x , int y ) { if ( mouseDragging ) { float rotateSpeed = 0.005f ; camera -> Rotate ( ( y - prevMousePos . y ) * rotateSpeed , ( x - prevMousePos . x ) * rotateSpeed ) ; } prevMousePos . x = x ; prevMousePos . y = y ; }
Helper method for mouse movement.
Helper method for mouse movement .
// Add any custom code here... // Save the previous mouse position, so we have it for the future