hedgewars/uMobile.pas
changeset 7237 1bbe31e0d707
parent 7048 0a4c88935902
child 7557 5a28d3cfbf62
equal deleted inserted replaced
7233:225179f64fd8 7237:1bbe31e0d707
    26 
    26 
    27 unit uMobile;
    27 unit uMobile;
    28 interface
    28 interface
    29 
    29 
    30 function  isPhone: Boolean; inline;
    30 function  isPhone: Boolean; inline;
       
    31 function  getScreenDPI: Single; inline;
    31 procedure performRumble; inline;
    32 procedure performRumble; inline;
    32 
    33 
    33 procedure GameLoading; inline;
    34 procedure GameLoading; inline;
    34 procedure GameLoaded; inline;
    35 procedure GameLoaded; inline;
    35 procedure SaveLoadingEnded; inline;
    36 procedure SaveLoadingEnded; inline;
    45 procedure saveFinishedSynching; cdecl; external;
    46 procedure saveFinishedSynching; cdecl; external;
    46 function  isApplePhone: Boolean; cdecl; external;
    47 function  isApplePhone: Boolean; cdecl; external;
    47 procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external;
    48 procedure AudioServicesPlaySystemSound(num: LongInt); cdecl; external;
    48 {$ENDIF}
    49 {$ENDIF}
    49 
    50 
       
    51 {$IFDEF ANDROID}
       
    52 function Android_JNI_getDensity(): Single; cdecl; external;
       
    53 {$ENDIF}
       
    54 
    50 // this function is just to determine whether we are running on a limited screen device
    55 // this function is just to determine whether we are running on a limited screen device
    51 function isPhone: Boolean; inline;
    56 function isPhone: Boolean; inline;
    52 begin
    57 begin
    53     isPhone:= false;
    58     isPhone:= false;
    54 {$IFDEF IPHONEOS}
    59 {$IFDEF IPHONEOS}
    56 {$ENDIF}
    61 {$ENDIF}
    57 {$IFDEF ANDROID}
    62 {$IFDEF ANDROID}
    58     //nasty nasty hack. TODO: implement callback to java to have a unified way of determining if it is a tablet
    63     //nasty nasty hack. TODO: implement callback to java to have a unified way of determining if it is a tablet
    59     if (cScreenWidth < 1000) and (cScreenHeight < 500) then
    64     if (cScreenWidth < 1000) and (cScreenHeight < 500) then
    60         isPhone:= true;
    65         isPhone:= true;
       
    66 {$ENDIF}
       
    67 end;
       
    68 
       
    69 function getScreenDPI: Single; inline;
       
    70 begin
       
    71 {$IFDEF ANDROID}
       
    72     getScreenDPI:= Android_JNI_getDensity();
       
    73 {$ELSE}
       
    74     getScreenDPI:= 1;
    61 {$ENDIF}
    75 {$ENDIF}
    62 end;
    76 end;
    63 
    77 
    64 // this function should make the device vibrate in some way
    78 // this function should make the device vibrate in some way
    65 procedure PerformRumble; inline;
    79 procedure PerformRumble; inline;