hedgewars/uTouch.pas
changeset 7278 000e4543f204
parent 7246 7773a1c92e1b
child 7850 fcbb024090a4
--- a/hedgewars/uTouch.pas	Tue Jun 12 17:20:27 2012 +0400
+++ b/hedgewars/uTouch.pas	Sun Jun 24 20:31:26 2012 +0400
@@ -22,7 +22,7 @@
 
 interface
 
-uses SysUtils, uConsole, uVariables, SDLh, uFloat, uConsts, uCommands, uIO, GLUnit, uTypes, uCaptions, uAmmos, uWorld;
+uses SysUtils, uConsole, uVariables, SDLh, uFloat, uConsts, uCommands, uIO, GLUnit, uTypes, uCaptions, uAmmos, uWorld, uMobile;
 
 
 procedure initModule;
@@ -557,7 +557,7 @@
     isOnCrosshair:= isOnRect((x-HalfRectSize), (y-HalfRectSize), RectSize, RectSize, finger);
     printFinger(finger);
     WriteLnToConsole(inttostr(finger.x) + '   ' + inttostr(x));
-    WriteLnToConsole(inttostr(x) + '  ' + inttostr(y) + '   ' + inttostr(round(Android_JNI_getDensity() * 10)));
+    WriteLnToConsole(inttostr(x) + '  ' + inttostr(y) + '   ' + inttostr(round(uMobile.getScreenDPI * 10)));
 end;
 
 function isOnCurrentHog(finger: TTouch_Data): boolean;
@@ -632,7 +632,6 @@
 var
     index: Longword;
     //uRenderCoordScaleX, uRenderCoordScaleY: Longword;
-    density: Single;
 begin
     buttonsDown:= 0;
 
@@ -640,13 +639,7 @@
     for index := 0 to High(fingers) do 
         fingers[index].id := nilFingerId;
 
-{$IFDEF ANDROID}
-    density:= Android_JNI_getDensity();
-{$ELSE}
-    density:= 1.0;
-{$ENDIF}
-
-    rectSize:= round(baseRectSize * density);
+    rectSize:= round(baseRectSize * uMobile.getScreenDPI);
     halfRectSize:= rectSize shl 1;
 end;