// called every frame
void heartbeat()
{
GetCursorPos(&point);
SetCursorPos(screenWidth/2,screenHeight/2);
delta.x=point.x-lastPoint.x;
delta.y=point.y-lastPoint.y;
lastPoint.x=point.x;
lastPoint.y=point.y;
}
I also want to determine if the mouse buttons are depressed. I was thinking of something simple like this:
// gets called when a WM_LBUTTONDOWN message comes in
void OnLButtonDown()
{
leftButton=TRUE;
}
// gets called when a WM_LBUTTONUP message comes in
void OnLButtonUp()
{
leftButton=FALSE;
}
// then in heartbeat() I can just do:
if(leftButton)
...
Does all that look right ? Maybe there is a better way ? Thank you.






