hedgewars/uMobile.pas
author nemo
Mon, 11 Oct 2010 12:37:42 -0400
changeset 3961 cf0ca1ff6c1a
parent 3948 24daa33a3114
child 3952 d6412423da45
permissions -rw-r--r--
Constrain to <= to avoid a bug on bottom edge reported by Henek
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
     1
(*
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
     3
 * Copyright (c) 2004-2008 Andrey Korotaev <unC0Rr@gmail.com>
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
     4
 *
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
     8
 *
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    12
 * GNU General Public License for more details.
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    13
 *
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    17
 *)
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    18
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    19
{$INCLUDE "options.inc"}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    20
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    21
unit uMobile;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    22
interface
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    23
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    24
{$IFDEF IPHONEOS}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    25
(*  iOS calls written in C/Objc  *)
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    26
procedure clearView; cdecl; external;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    27
procedure startSpinning; cdecl; external;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    28
procedure stopSpinning; cdecl; external;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    29
procedure replayBegan; cdecl; external;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    30
procedure replayFinished; cdecl; external;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    31
procedure updateVisualsNewTurn; cdecl; external;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    32
function  isApplePhone: Boolean; cdecl; external;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    33
{$ENDIF}
3948
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    34
function  isPhone: Boolean; inline;
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    35
procedure doRumble; inline;
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    36
procedure perfExt_AddProgress; inline;
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    37
procedure perfExt_FinishProgress; inline;
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    38
procedure perfExt_AmmoUpdate; // don't inline
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    39
procedure perfExt_NewTurnBeginning; inline;
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    40
procedure perfExt_SaveBeganSynching; inline;
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    41
procedure perfExt_SaveFinishedSynching; inline;
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    42
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    43
implementation
3940
cc29628976cc some optimizations to drawing and fetching data of new ammomenu
koda
parents: 3935
diff changeset
    44
uses uTeams;
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    45
3948
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    46
function isPhone: Boolean; inline;
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    47
begin
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    48
{$IFDEF IPHONEOS}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    49
    exit(isApplePhone());
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    50
{$ENDIF}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    51
    exit(false);
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    52
end;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    53
3948
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    54
procedure doRumble; inline;
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    55
begin
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    56
    // fill me!
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    57
end;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    58
3948
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    59
procedure perfExt_AddProgress; inline;
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    60
begin
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    61
{$IFDEF IPHONEOS}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    62
    startSpinning();
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    63
{$ENDIF}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    64
end;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    65
3948
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    66
procedure perfExt_FinishProgress; inline;
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    67
begin
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    68
{$IFDEF IPHONEOS}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    69
    stopSpinning();
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    70
{$ENDIF}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    71
end;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    72
3948
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    73
procedure perfExt_AmmoUpdate; // don't inline
3935
5ca27a0e9a63 made the new menu toggable
koda
parents: 3928
diff changeset
    74
begin
5ca27a0e9a63 made the new menu toggable
koda
parents: 3928
diff changeset
    75
{$IFDEF IPHONEOS}
3940
cc29628976cc some optimizations to drawing and fetching data of new ammomenu
koda
parents: 3935
diff changeset
    76
    if (CurrentTeam^.ExtDriven) or (CurrentTeam^.Hedgehogs[0].BotLevel <> 0) then
cc29628976cc some optimizations to drawing and fetching data of new ammomenu
koda
parents: 3935
diff changeset
    77
        exit(); // the other way around throws a compiler error
3935
5ca27a0e9a63 made the new menu toggable
koda
parents: 3928
diff changeset
    78
    updateVisualsNewTurn();
5ca27a0e9a63 made the new menu toggable
koda
parents: 3928
diff changeset
    79
{$ENDIF}
5ca27a0e9a63 made the new menu toggable
koda
parents: 3928
diff changeset
    80
end;
5ca27a0e9a63 made the new menu toggable
koda
parents: 3928
diff changeset
    81
3948
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    82
procedure perfExt_NewTurnBeginning; inline;
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    83
begin
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    84
{$IFDEF IPHONEOS}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    85
    clearView();
3948
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    86
    perfExt_AmmoUpdate();
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    87
{$ENDIF}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    88
end;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    89
3948
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    90
procedure perfExt_SaveBeganSynching; inline;
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    91
begin
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    92
{$IFDEF IPHONEOS}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    93
    replayBegan();
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    94
{$ENDIF}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    95
end;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    96
3948
24daa33a3114 some rethinking of initial menu presentation and initial orientation (also merging images should be threadsafe now)
koda
parents: 3940
diff changeset
    97
procedure perfExt_SaveFinishedSynching; inline;
3928
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    98
begin
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
    99
{$IFDEF IPHONEOS}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
   100
    replayFinished();
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
   101
{$ENDIF}
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
   102
end;
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
   103
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
   104
2560731c860d move all mobile-related functions in their own module, provides a structure for future mobile ports
koda
parents:
diff changeset
   105
end.