hedgewars/uCursor.pas
branchflibqtfrontend
changeset 8363 0b4ac686fc44
parent 8346 3443e0de2c9d
child 8444 75db7bb8dce8
--- a/hedgewars/uCursor.pas	Tue Dec 18 20:48:37 2012 +0400
+++ b/hedgewars/uCursor.pas	Fri Jan 04 21:44:40 2013 +0400
@@ -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.