Here's the code I'm using.
void Paddle::Update(void)
{
int xTemp;
if ((xTemp = mousePtr->X()) <= leftLimit) {
MoveTo(leftLimit+1, 570);
mousePtr->Position(leftLimit, 570);
} else if (mousePtr->X() > rightLimit) { // give the right side a little wiggle room
MoveTo (rightLimit, 570);
mousePtr->Position(rightLimit, 570);
}
mousePtr->Y(570);
MoveTo(mousePtr->X(), 570);
}
xTemp is just a way to hold the value since the debugger seems to have some trouble getting the return value of the mousePtr->X() call. leftLimit is set to zero but I know that if it goes off the left side of the window it won't give me a negative number. So I guess I'm looking for a method to tell me that it has gone off the left edge.
Strangely enough, I don't have any code to return it to the center of the window, but that's where it jumps. This is 2D and everything else behaves in 2D coordinates
Lilith, Night Butterfly
I'm not a programmer but I play one in the office