hedgewars/uCursor.pas
changeset 8346 3443e0de2c9d
parent 8225 186229af4fc1
child 8444 75db7bb8dce8
--- a/hedgewars/uCursor.pas	Fri Dec 28 23:54:42 2012 +0100
+++ b/hedgewars/uCursor.pas	Sat Dec 29 22:50:10 2012 +0100
@@ -5,6 +5,7 @@
 procedure init;
 procedure resetPosition;
 procedure updatePosition;
+procedure handlePositionUpdate(x, y: LongInt);
 
 implementation
 
@@ -24,15 +25,20 @@
 var x, y: LongInt;
 begin
     SDL_GetMouseState(@x, @y);
-
+    
     if(x <> cScreenWidth div 2) or (y <> cScreenHeight div 2) then
-        begin
-        CursorPoint.X:= CursorPoint.X + x - cScreenWidth div 2;
-        CursorPoint.Y:= CursorPoint.Y - y + cScreenHeight div 2;
+    begin
+        handlePositionUpdate(x - cScreenWidth div 2, y - cScreenHeight div 2);
 
         if cHasFocus then
             SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
-        end
+    end
+end;
+
+procedure handlePositionUpdate(x, y: LongInt);
+begin
+    CursorPoint.X:= CursorPoint.X + x;
+    CursorPoint.Y:= CursorPoint.Y - y;
 end;
 
 end.