hedgewars/uUtils.pas
changeset 9377 48ab6dea8d2f
parent 9300 e5dafb5843c6
child 9521 8054d9d775fd
child 9642 8a691e0f117a
equal deleted inserted replaced
9376:0405f5f4e7e0 9377:48ab6dea8d2f
    68 
    68 
    69 procedure Write(var f: textfile; s: shortstring);
    69 procedure Write(var f: textfile; s: shortstring);
    70 procedure WriteLn(var f: textfile; s: shortstring);
    70 procedure WriteLn(var f: textfile; s: shortstring);
    71 
    71 
    72 function  isPhone: Boolean; inline;
    72 function  isPhone: Boolean; inline;
    73 function  getScreenDPI: Double; inline; //cdecl; external;
       
    74 
    73 
    75 {$IFDEF IPHONEOS}
    74 {$IFDEF IPHONEOS}
    76 procedure startLoadingIndicator; cdecl; external;
    75 procedure startLoadingIndicator; cdecl; external;
    77 procedure stopLoadingIndicator; cdecl; external;
    76 procedure stopLoadingIndicator; cdecl; external;
    78 procedure saveFinishedSynching; cdecl; external;
    77 procedure saveFinishedSynching; cdecl; external;
   426     if (cScreenWidth < 1000) and (cScreenHeight < 500) then
   425     if (cScreenWidth < 1000) and (cScreenHeight < 500) then
   427         isPhone:= true;
   426         isPhone:= true;
   428 {$ENDIF}
   427 {$ENDIF}
   429 end;
   428 end;
   430 
   429 
   431 //This dummy function should be reimplemented (externally).
       
   432 function getScreenDPI: Double; inline;
       
   433 begin
       
   434 {$IFDEF ANDROID}
       
   435 //    getScreenDPI:= Android_JNI_getDensity();
       
   436     getScreenDPI:= 1;
       
   437 {$ELSE}
       
   438     getScreenDPI:= 1;
       
   439 {$ENDIF}
       
   440 end;
       
   441 
   430 
   442 function  sanitizeForLog(s: shortstring): shortstring;
   431 function  sanitizeForLog(s: shortstring): shortstring;
   443 var i: byte;
   432 var i: byte;
   444     r: shortstring;
   433     r: shortstring;
   445 begin
   434 begin
   504     Rewrite(f);
   493     Rewrite(f);
   505 {$I+}
   494 {$I+}
   506 {$ENDIF}
   495 {$ENDIF}
   507 
   496 
   508     //mobile stuff
   497     //mobile stuff
   509     mobileRecord.getScreenDPI:= @getScreenDPI; //TODO: define external function.
       
   510 {$IFDEF IPHONEOS}
   498 {$IFDEF IPHONEOS}
   511     mobileRecord.PerformRumble:= @AudioServicesPlaySystemSound;
   499     mobileRecord.PerformRumble:= @AudioServicesPlaySystemSound;
   512     mobileRecord.GameLoading:= @startLoadingIndicator;
   500     mobileRecord.GameLoading:= @startLoadingIndicator;
   513     mobileRecord.GameLoaded:= @stopLoadingIndicator;
   501     mobileRecord.GameLoaded:= @stopLoadingIndicator;
   514     mobileRecord.SaveLoadingEnded:= @saveFinishedSynching;
   502     mobileRecord.SaveLoadingEnded:= @saveFinishedSynching;