hedgewars/PascalExports.pas
author nemo
Sun, 14 Mar 2010 14:59:08 +0000
changeset 2986 c0c91cd3f423
parent 2948 3f21a9dc93d0
child 3015 20a9c8160e82
permissions -rw-r--r--
Trying to tweak kicks a bit
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
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    16
uses uKeys, uConsole;
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
{$IFDEF IPHONEOS}
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    21
// called by pascal code, they deal with the objc code
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    22
function  IPH_getDocumentsPath: PChar; cdecl; external;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    23
procedure IPH_showControls; cdecl; external;
2803
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
    24
{$ENDIF}
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    25
2803
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
    26
{$IFDEF HWLIBRARY}
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    27
// retrieve protocol information
2799
558b29bf00c5 add a new way to fetch version info from pascal to c
koda
parents: 2754
diff changeset
    28
procedure HW_versionInfo(netProto: PShortInt; versionStr: PString); cdecl; export;
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    29
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    30
// called by the touch functions (SDL_uikitview.m)
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    31
// they emulate user interaction from mouse or keyboard
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    32
procedure HW_click; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    33
procedure HW_zoomIn; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    34
procedure HW_zoomOut; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    35
procedure HW_zoomReset; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    36
procedure HW_ammoMenu; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    37
procedure HW_allKeysUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    38
procedure HW_walkLeft; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    39
procedure HW_walkRight; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    40
procedure HW_aimUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    41
procedure HW_aimDown; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    42
procedure HW_shoot; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    43
procedure HW_whereIsHog; cdecl; export;
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
    44
procedure HW_chat; cdecl; export;
2805
36a8cebb91e8 new menupage ingame for common actions
koda
parents: 2803
diff changeset
    45
procedure HW_pause; cdecl; export;
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
    46
procedure HW_tab; cdecl; export;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    47
{$ENDIF}
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    48
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    49
implementation
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    50
2803
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
    51
{$IFDEF HWLIBRARY}
2799
558b29bf00c5 add a new way to fetch version info from pascal to c
koda
parents: 2754
diff changeset
    52
procedure HW_versionInfo(netProto: PShortInt; versionStr: PString); cdecl; export;
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    53
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    54
    if netProto <> nil then netProto^:= cNetProtoVersion;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    55
    if versionStr <> nil then versionStr^:= shortstring(cVersionString);
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    56
end;
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    57
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    58
procedure HW_click; 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
    leftClick:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    61
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    62
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    63
procedure HW_zoomIn; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    64
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    65
    wheelUp:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    66
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    67
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    68
procedure HW_zoomOut; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    69
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    70
    wheelDown:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    71
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    72
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    73
procedure HW_zoomReset; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    74
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    75
    middleClick:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    76
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    77
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    78
procedure HW_ammoMenu; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    79
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    80
    rightClick:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    81
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    82
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    83
procedure HW_allKeysUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    84
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    85
    // set all keys to released
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    86
    init_uKeys();
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    87
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    88
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    89
procedure HW_walkLeft; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    90
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    91
    leftKey:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    92
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    93
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    94
procedure HW_walkRight; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    95
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
    96
    rightKey:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    97
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    98
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    99
procedure HW_aimUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   100
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   101
    upKey:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   102
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   103
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   104
procedure HW_aimDown; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   105
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   106
    downKey:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   107
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   108
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   109
procedure HW_shoot; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   110
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   111
    spaceKey:= true;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   112
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   113
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   114
procedure HW_chat; cdecl; export;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   115
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   116
    chatAction:= true;
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   117
end;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   118
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   119
procedure HW_tab; cdecl; export;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   120
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   121
    switchAction:= true;
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   122
end;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   123
2805
36a8cebb91e8 new menupage ingame for common actions
koda
parents: 2803
diff changeset
   124
procedure HW_pause; cdecl; export;
36a8cebb91e8 new menupage ingame for common actions
koda
parents: 2803
diff changeset
   125
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   126
    pauseAction:= true;
2805
36a8cebb91e8 new menupage ingame for common actions
koda
parents: 2803
diff changeset
   127
end;
36a8cebb91e8 new menupage ingame for common actions
koda
parents: 2803
diff changeset
   128
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   129
procedure HW_whereIsHog; cdecl; export;
2698
90585aba87ad objc/pascal finally working
koda
parents: 2692
diff changeset
   130
//var Xcoord, Ycoord: LongInt;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   131
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   132
    //Xcoord:= Gear^.dX + WorldDx;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   133
    WriteLnToConsole('HW - hog is at x: ' + ' y:');
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   134
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2924
diff changeset
   135
    exit
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   136
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   137
{$ENDIF}
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   138
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   139
end.
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   140