This is my code... curX and curY are my current X and Y coordinates while tmpX and tmpY are relative X and Y values (how much the mouse has moved).
curX:= curX+tmpX;
curY:= curY+tmpY;
I use these values to move/control my cursor-shaped form.
How can I keep the cursors within the screen?
I tried limiting the values until Screen.Height and Screen.Width...here's the code.
if(curX>Screen.Width) then
curX:=Screen.Width;
if(curY>Screen.Height) then
curY:=Screen.Height;
but it didn't work.
Solved it! (Sort of):
curX:= max(0, min((curX+tmpX), Screen.Width));
curY:= max(0, min((curY+tmpY), Screen.Height));
The only issue I have is that (0,0) is apparently not the upper left most (very close though, just a couple of pixels off I think) and (Screen.Width, Screen.Height) is not the upper right most (also close, the cursor disappears at the right most, though I think is one is supposed to behave that way).