SpaceWars/Game.cpp
// --------------------------------------------------------
// Helper method for mouse clicking.  We get this information
// from the OS-level messages anyway, so these helpers have
// been created to provide basic mouse input if you want it.
// --------------------------------------------------------
Helper method for mouse clicking.  We get this information
from the OS-level messages anyway, so these helpers have
been created to provide basic mouse input if you want it.
Helper method for mouse clicking . We get this information from the OS - level messages anyway so these helpers have been created to provide basic mouse input if you want it .
void Game::OnMouseDown(WPARAM buttonState, int x, int y)
{
	if (buttonState & 0x0001) {
		mouseDragging = true;
	}
	prevMousePos.x = x;
	prevMousePos.y = y;
	SetCapture(hWnd);
}
void Game :: OnMouseDown ( WPARAM buttonState , int x , int y ) { if ( buttonState & 0x0001 ) { mouseDragging = true ; } prevMousePos . x = x ; prevMousePos . y = y ; SetCapture ( hWnd ) ; }
Helper method for mouse clicking.
Helper method for mouse clicking .
// Add any custom code here... // Save the previous mouse position, so we have it for the future // Caputure the mouse so we keep getting mouse move // events even if the mouse leaves the window.  we'll be // releasing the capture once a mouse button is released