hedgewars/PascalExports.pas
author koda
Wed, 10 Feb 2010 22:00:49 +0000
changeset 2799 558b29bf00c5
parent 2754 ad4f81fbfb76
child 2803 1f446fc5c8ec
permissions -rw-r--r--
add a new way to fetch version info from pascal to c complete the stubs for the new lua section fixed a glitch in the ifrontend
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;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    24
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    25
// retrieve protocol information
2799
558b29bf00c5 add a new way to fetch version info from pascal to c
koda
parents: 2754
diff changeset
    26
procedure HW_versionInfo(netProto: PShortInt; versionStr: PString); cdecl; export;
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    27
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    28
// called by the touch functions (SDL_uikitview.m)
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    29
// they emulate user interaction from mouse or keyboard
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    30
procedure HW_click; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    31
procedure HW_zoomIn; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    32
procedure HW_zoomOut; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    33
procedure HW_zoomReset; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    34
procedure HW_ammoMenu; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    35
procedure HW_allKeysUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    36
procedure HW_walkLeft; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    37
procedure HW_walkRight; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    38
procedure HW_aimUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    39
procedure HW_aimDown; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    40
procedure HW_shoot; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    41
procedure HW_whereIsHog; cdecl; export;
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
    42
procedure HW_chat; cdecl; export;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
    43
procedure HW_tab; cdecl; export;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    44
{$ENDIF}
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    45
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    46
implementation
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    47
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    48
{$IFDEF IPHONEOS}
2799
558b29bf00c5 add a new way to fetch version info from pascal to c
koda
parents: 2754
diff changeset
    49
procedure HW_versionInfo(netProto: PShortInt; versionStr: PString); cdecl; export;
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    50
begin
2799
558b29bf00c5 add a new way to fetch version info from pascal to c
koda
parents: 2754
diff changeset
    51
	if netProto <> nil then netProto^:= cNetProtoVersion;
558b29bf00c5 add a new way to fetch version info from pascal to c
koda
parents: 2754
diff changeset
    52
	if versionStr <> nil then versionStr^:= string(cVersionString);
2691
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    53
end;
c0da3a98c01c initial support for engine protocol
koda
parents: 2690
diff changeset
    54
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    55
procedure HW_click; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    56
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    57
	leftClick:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    58
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    59
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    60
procedure HW_zoomIn; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    61
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    62
	wheelUp:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    63
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    64
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    65
procedure HW_zoomOut; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    66
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    67
	wheelDown:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    68
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    69
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    70
procedure HW_zoomReset; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    71
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    72
	middleClick:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    73
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    74
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    75
procedure HW_ammoMenu; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    76
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    77
	rightClick:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    78
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    79
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    80
procedure HW_allKeysUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    81
begin
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
    82
	// set all keys to released
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
    83
	init_uKeys();
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    84
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    85
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    86
procedure HW_walkLeft; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    87
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    88
	leftKey:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    89
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    90
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    91
procedure HW_walkRight; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    92
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    93
	rightKey:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    94
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    95
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    96
procedure HW_aimUp; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    97
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    98
	upKey:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
    99
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   100
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   101
procedure HW_aimDown; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   102
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   103
	downKey:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   104
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   105
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   106
procedure HW_shoot; cdecl; export;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   107
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   108
	spaceKey:= true;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   109
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   110
2754
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   111
procedure HW_chat; cdecl; export;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   112
begin
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   113
	chatAction:= true;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   114
end;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   115
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   116
procedure HW_tab; cdecl; export;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   117
begin
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   118
	switchAction:= true;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   119
end;
ad4f81fbfb76 touchinput works, invisible buttons added and initial support for chat
koda
parents: 2716
diff changeset
   120
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   121
procedure HW_whereIsHog; cdecl; export;
2698
90585aba87ad objc/pascal finally working
koda
parents: 2692
diff changeset
   122
//var Xcoord, Ycoord: LongInt;
2690
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   123
begin
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   124
	//Xcoord:= Gear^.dX + WorldDx;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   125
	WriteLnToConsole('HW - hog is at x: ' + ' y:');
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   126
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   127
	exit
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   128
end;
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   129
{$ENDIF}
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   130
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   131
end.
8e83c7e31720 move mixed functions in PascalExports
koda
parents:
diff changeset
   132