hedgewars/PascalExports.pas
author koda
Sat, 13 Feb 2010 01:56:35 +0000
changeset 2803 1f446fc5c8ec
parent 2799 558b29bf00c5
child 2805 36a8cebb91e8
permissions -rw-r--r--
allow to compile engine as library with HWLIBRARY symbol move the first run check in the first view controller instead of appdelegate relocate things around to make room for controls/buttons/menu
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
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    18
{$INCLUDE "proto.inc"}
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;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
    45
procedure HW_tab; cdecl; export;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    46
{$ENDIF}
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    47
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    48
implementation
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    49
2803
1f446fc5c8ec allow to compile engine as library with HWLIBRARY symbol
koda
parents: 2799
diff changeset
    50
{$IFDEF HWLIBRARY}
2799
558b29bf00c5 add a new way to fetch version info from pascal to c
koda
parents: 2754
diff changeset
    51
procedure HW_versionInfo(netProto: PShortInt; versionStr: PString); cdecl; export;
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    52
begin
2799
558b29bf00c5 add a new way to fetch version info from pascal to c
koda
parents: 2754
diff changeset
    53
	if netProto <> nil then netProto^:= cNetProtoVersion;
558b29bf00c5 add a new way to fetch version info from pascal to c
koda
parents: 2754
diff changeset
    54
	if versionStr <> nil then versionStr^:= string(cVersionString);
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    55
end;
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    56
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    57
procedure HW_click; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    58
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    59
	leftClick:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    60
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    61
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    62
procedure HW_zoomIn; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    63
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    64
	wheelUp:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    65
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    66
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    67
procedure HW_zoomOut; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    68
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    69
	wheelDown:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    70
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    71
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    72
procedure HW_zoomReset; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    73
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    74
	middleClick:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    75
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    76
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    77
procedure HW_ammoMenu; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    78
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    79
	rightClick:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    80
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    81
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    82
procedure HW_allKeysUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    83
begin
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
    84
	// set all keys to released
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
    85
	init_uKeys();
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    86
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    87
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    88
procedure HW_walkLeft; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    89
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    90
	leftKey:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    91
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    92
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    93
procedure HW_walkRight; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    94
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    95
	rightKey:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    96
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    97
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    98
procedure HW_aimUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    99
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   100
	upKey:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   101
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   102
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   103
procedure HW_aimDown; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   104
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   105
	downKey:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   106
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   107
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   108
procedure HW_shoot; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   109
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   110
	spaceKey:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   111
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   112
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   113
procedure HW_chat; cdecl; export;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   114
begin
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   115
	chatAction:= true;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   116
end;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   117
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   118
procedure HW_tab; cdecl; export;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   119
begin
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   120
	switchAction:= true;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   121
end;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   122
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   123
procedure HW_whereIsHog; cdecl; export;
2698
90585aba87ad objc/pascal finally working
koda
parents: 2692
diff changeset
   124
//var Xcoord, Ycoord: LongInt;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   125
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   126
	//Xcoord:= Gear^.dX + WorldDx;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   127
	WriteLnToConsole('HW - hog is at x: ' + ' y:');
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   128
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   129
	exit
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   130
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   131
{$ENDIF}
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   132
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   133
end.
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   134