hedgewars/PascalExports.pas
author koda
Sat, 26 Jun 2010 04:36:04 +0200
changeset 3551 d4de36b3801a
parent 3523 6592fbb969da
child 3626 19f78afa0188
permissions -rw-r--r--
moar zoom, fixed fort mode, other glitches but best of all, touch works fo' real
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
     1
(*
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
     2
 *  PascalExports.pas
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
     3
 *  hwengine
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
     4
 *
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
     5
 *  Created by Vittorio on 09/01/10.
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
     6
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
     7
 *
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
     8
 *)
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
     9
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    10
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    11
{$INCLUDE "options.inc"}
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    12
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    13
unit PascalExports;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    14
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    15
interface
3551
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
    16
uses uKeys, GLunit, uWorld, uMisc, uConsole, hwengine;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    17
2924
908851e59958 Engine:
smxx
parents: 2905
diff changeset
    18
{$INCLUDE "config.inc"}
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    19
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    20
implementation
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    21
2803
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
    22
{$IFDEF HWLIBRARY}
3063
0092dc37fbd6 reworked interaction of engine/frontend when closing
koda
parents: 3040
diff changeset
    23
// retrieve protocol information
3245
252be02536ab fix an error in passing strings between ObjC and Pascal
koda
parents: 3063
diff changeset
    24
procedure HW_versionInfo(netProto: PShortInt; versionStr: Ppchar); cdecl; export;
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    25
begin
3245
252be02536ab fix an error in passing strings between ObjC and Pascal
koda
parents: 3063
diff changeset
    26
// http://bugs.freepascal.org/view.php?id=16156
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    27
    if netProto <> nil then netProto^:= cNetProtoVersion;
3245
252be02536ab fix an error in passing strings between ObjC and Pascal
koda
parents: 3063
diff changeset
    28
    if versionStr <> nil then versionStr^:= cVersionString;
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    29
end;
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    30
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    31
procedure HW_click; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    32
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    33
    leftClick:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    34
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    35
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    36
procedure HW_zoomIn; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    37
begin
3523
6592fbb969da fix zoom smoothness
koda
parents: 3463
diff changeset
    38
    if wheelDown = false then
6592fbb969da fix zoom smoothness
koda
parents: 3463
diff changeset
    39
        wheelUp:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    40
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    41
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    42
procedure HW_zoomOut; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    43
begin
3523
6592fbb969da fix zoom smoothness
koda
parents: 3463
diff changeset
    44
    if wheelUp = false then
6592fbb969da fix zoom smoothness
koda
parents: 3463
diff changeset
    45
        wheelDown:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    46
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    47
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    48
procedure HW_zoomReset; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    49
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    50
    middleClick:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    51
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    52
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    53
procedure HW_ammoMenu; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    54
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    55
    rightClick:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    56
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    57
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    58
procedure HW_allKeysUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    59
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    60
    // set all keys to released
3040
3e7f4a30e18a Insert commit message here (to get along with palewolf)
koda
parents: 3015
diff changeset
    61
    uKeys.initModule;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    62
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    63
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    64
procedure HW_walkLeft; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    65
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    66
    leftKey:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    67
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    68
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    69
procedure HW_walkRight; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    70
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    71
    rightKey:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    72
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    73
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    74
procedure HW_aimUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    75
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    76
    upKey:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    77
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    78
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    79
procedure HW_aimDown; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    80
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    81
    downKey:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    82
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    83
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    84
procedure HW_shoot; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    85
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    86
    spaceKey:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    87
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    88
3015
20a9c8160e82 add jump and backjump controls
koda
parents: 2948
diff changeset
    89
procedure HW_jump; cdecl; export;
20a9c8160e82 add jump and backjump controls
koda
parents: 2948
diff changeset
    90
begin
20a9c8160e82 add jump and backjump controls
koda
parents: 2948
diff changeset
    91
    enterKey:= true;
20a9c8160e82 add jump and backjump controls
koda
parents: 2948
diff changeset
    92
end;
20a9c8160e82 add jump and backjump controls
koda
parents: 2948
diff changeset
    93
20a9c8160e82 add jump and backjump controls
koda
parents: 2948
diff changeset
    94
procedure HW_backjump; cdecl; export;
20a9c8160e82 add jump and backjump controls
koda
parents: 2948
diff changeset
    95
begin
20a9c8160e82 add jump and backjump controls
koda
parents: 2948
diff changeset
    96
    backspaceKey:= true;
20a9c8160e82 add jump and backjump controls
koda
parents: 2948
diff changeset
    97
end;
20a9c8160e82 add jump and backjump controls
koda
parents: 2948
diff changeset
    98
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
    99
procedure HW_chat; cdecl; export;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   100
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   101
    chatAction:= true;
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   102
end;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   103
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   104
procedure HW_tab; cdecl; export;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   105
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   106
    switchAction:= true;
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   107
end;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   108
2805
36a8cebb91e8 new menupage ingame for common actions
koda
parents: 2803
diff changeset
   109
procedure HW_pause; cdecl; export;
36a8cebb91e8 new menupage ingame for common actions
koda
parents: 2803
diff changeset
   110
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   111
    pauseAction:= true;
2805
36a8cebb91e8 new menupage ingame for common actions
koda
parents: 2803
diff changeset
   112
end;
36a8cebb91e8 new menupage ingame for common actions
koda
parents: 2803
diff changeset
   113
3347
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   114
procedure HW_cursorUp(coefficient:LongInt); cdecl; export;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   115
begin
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   116
    coeff:= coefficient;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   117
    cursorUp:= true;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   118
end;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   119
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   120
procedure HW_cursorDown(coefficient:LongInt); cdecl; export;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   121
begin
3347
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   122
    coeff:= coefficient;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   123
    cursorDown:= true;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   124
end;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   125
3347
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   126
procedure HW_cursorLeft(coefficient:LongInt); cdecl; export;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   127
begin
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   128
    coeff:= coefficient;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   129
    cursorLeft:= true;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   130
end;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   131
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   132
procedure HW_cursorRight(coefficient:LongInt); cdecl; export;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   133
begin
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   134
    coeff:= coefficient;
5d0ac8197eb7 camera panning ftw
koda
parents: 3245
diff changeset
   135
    cursorRight:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   136
end;
3063
0092dc37fbd6 reworked interaction of engine/frontend when closing
koda
parents: 3040
diff changeset
   137
0092dc37fbd6 reworked interaction of engine/frontend when closing
koda
parents: 3040
diff changeset
   138
procedure HW_terminate(closeFrontend: boolean); cdecl; export;
0092dc37fbd6 reworked interaction of engine/frontend when closing
koda
parents: 3040
diff changeset
   139
begin
0092dc37fbd6 reworked interaction of engine/frontend when closing
koda
parents: 3040
diff changeset
   140
    isTerminated:= true;
0092dc37fbd6 reworked interaction of engine/frontend when closing
koda
parents: 3040
diff changeset
   141
    if closeFrontend then alsoShutdownFrontend:= true;
0092dc37fbd6 reworked interaction of engine/frontend when closing
koda
parents: 3040
diff changeset
   142
end;
3395
095273ad0e08 adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents: 3347
diff changeset
   143
095273ad0e08 adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents: 3347
diff changeset
   144
procedure HW_setLandscape(landscape: boolean); cdecl; export;
095273ad0e08 adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents: 3347
diff changeset
   145
begin
095273ad0e08 adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents: 3347
diff changeset
   146
    if landscape then
095273ad0e08 adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents: 3347
diff changeset
   147
    begin
3463
23c50be687a9 update sdl functions to latest revision
koda
parents: 3405
diff changeset
   148
        cOffsetY:= 0;
3395
095273ad0e08 adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents: 3347
diff changeset
   149
    end
095273ad0e08 adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents: 3347
diff changeset
   150
    else
095273ad0e08 adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents: 3347
diff changeset
   151
    begin
3463
23c50be687a9 update sdl functions to latest revision
koda
parents: 3405
diff changeset
   152
        cOffsetY:= 120;
3395
095273ad0e08 adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents: 3347
diff changeset
   153
    end;
095273ad0e08 adding a somewhat working autoration for ipad (uStore.pas and uWorld.pas got mixed in the last two commits)
koda
parents: 3347
diff changeset
   154
end;
3551
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   155
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   156
procedure HW_setCursor(x,y: LongInt); cdecl; export;
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   157
begin
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   158
    CursorPoint.X:= x;
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   159
    CursorPoint.Y:= y;
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   160
end;
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   161
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   162
function HW_isAmmoOpen:boolean; cdecl; export;
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   163
begin
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   164
    exit(bShowAmmoMenu);
d4de36b3801a moar zoom, fixed fort mode, other glitches
koda
parents: 3523
diff changeset
   165
end;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   166
{$ENDIF}
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   167
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   168
end.
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   169