hedgewars/uMobile.pas
branchexperimental3D
changeset 4004 b1c2c2f6fc5e
parent 3952 d6412423da45
child 4034 634a8c8682de
equal deleted inserted replaced
3698:793386610068 4004:b1c2c2f6fc5e
       
     1 (*
       
     2  * Hedgewars, a free turn based strategy game
       
     3  * Copyright (c) 2004-2008 Andrey Korotaev <unC0Rr@gmail.com>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation; version 2 of the License
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
       
    17  *)
       
    18 
       
    19 {$INCLUDE "options.inc"}
       
    20 
       
    21 unit uMobile;
       
    22 interface
       
    23 
       
    24 {$IFDEF IPHONEOS}
       
    25 (*  iOS calls written in C/Objc  *)
       
    26 procedure clearView; cdecl; external;
       
    27 procedure startSpinning; cdecl; external;
       
    28 procedure stopSpinning; cdecl; external;
       
    29 procedure replayBegan; cdecl; external;
       
    30 procedure replayFinished; cdecl; external;
       
    31 procedure updateVisualsNewTurn; cdecl; external;
       
    32 function  isApplePhone: Boolean; cdecl; external;
       
    33 {$ENDIF}
       
    34 function  isPhone: Boolean; inline;
       
    35 procedure doRumble; inline;
       
    36 procedure perfExt_AddProgress; inline;
       
    37 procedure perfExt_FinishProgress; inline;
       
    38 procedure perfExt_AmmoUpdate; // don't inline
       
    39 procedure perfExt_NewTurnBeginning; inline;
       
    40 procedure perfExt_SaveBeganSynching; inline;
       
    41 procedure perfExt_SaveFinishedSynching; inline;
       
    42 
       
    43 implementation
       
    44 uses uTeams, uConsole;
       
    45 
       
    46 function isPhone: Boolean; inline;
       
    47 begin
       
    48 {$IFDEF IPHONEOS}
       
    49     exit(isApplePhone());
       
    50 {$ENDIF}
       
    51     exit(false);
       
    52 end;
       
    53 
       
    54 procedure doRumble; inline;
       
    55 begin
       
    56     // fill me!
       
    57 end;
       
    58 
       
    59 procedure perfExt_AddProgress; inline;
       
    60 begin
       
    61 {$IFDEF IPHONEOS}
       
    62     startSpinning();
       
    63 {$ENDIF}
       
    64 end;
       
    65 
       
    66 procedure perfExt_FinishProgress; inline;
       
    67 begin
       
    68 {$IFDEF IPHONEOS}
       
    69     stopSpinning();
       
    70 {$ENDIF}
       
    71 end;
       
    72 
       
    73 procedure perfExt_AmmoUpdate; // don't inline
       
    74 begin
       
    75 {$IFDEF IPHONEOS}
       
    76     if (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
       
    77         exit(); // the other way around throws a compiler error
       
    78     updateVisualsNewTurn();
       
    79 {$ENDIF}
       
    80 end;
       
    81 
       
    82 procedure perfExt_NewTurnBeginning; inline;
       
    83 begin
       
    84 {$IFDEF IPHONEOS}
       
    85     clearView();
       
    86     perfExt_AmmoUpdate();
       
    87 {$ENDIF}
       
    88 end;
       
    89 
       
    90 procedure perfExt_SaveBeganSynching; inline;
       
    91 begin
       
    92 {$IFDEF IPHONEOS}
       
    93     replayBegan();
       
    94 {$ENDIF}
       
    95 end;
       
    96 
       
    97 procedure perfExt_SaveFinishedSynching; inline;
       
    98 begin
       
    99 {$IFDEF IPHONEOS}
       
   100     replayFinished();
       
   101 {$ENDIF}
       
   102 end;
       
   103 
       
   104 
       
   105 end.