2 Copyright (C) 2003, 2010 - Wolfire Games
4 This file is part of Lugaru.
6 Lugaru is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 /**> HEADER FILES <**/
28 #include "MacCompatibility.h"
30 /**> CONSTANT DECLARATIONS <**/
32 #define MAC_1_KEY 0x12
33 #define MAC_2_KEY 0x13
34 #define MAC_3_KEY 0x14
35 #define MAC_4_KEY 0x15
36 #define MAC_5_KEY 0x17
37 #define MAC_6_KEY 0x16
38 #define MAC_7_KEY 0x1A
39 #define MAC_8_KEY 0x1C
40 #define MAC_9_KEY 0x19
41 #define MAC_0_KEY 0x1D
42 #define MAC_NUMPAD_1_KEY 0x53
43 #define MAC_NUMPAD_2_KEY 0x54
44 #define MAC_NUMPAD_3_KEY 0x55
45 #define MAC_NUMPAD_4_KEY 0x56
46 #define MAC_NUMPAD_5_KEY 0x57
47 #define MAC_NUMPAD_6_KEY 0x58
48 #define MAC_NUMPAD_7_KEY 0x59
49 #define MAC_NUMPAD_8_KEY 0x5B
50 #define MAC_NUMPAD_9_KEY 0x5C
51 #define MAC_NUMPAD_0_KEY 0x52
52 #define MAC_A_KEY 0x00
53 #define MAC_B_KEY 0x0B
54 #define MAC_C_KEY 0x08
55 #define MAC_D_KEY 0x02
56 #define MAC_E_KEY 0x0E
57 #define MAC_F_KEY 0x03
58 #define MAC_G_KEY 0x05
59 #define MAC_H_KEY 0x04
60 #define MAC_I_KEY 0x22
61 #define MAC_J_KEY 0x26
62 #define MAC_K_KEY 0x28
63 #define MAC_L_KEY 0x25
64 #define MAC_M_KEY 0x2E
65 #define MAC_N_KEY 0x2D
66 #define MAC_O_KEY 0x1F
67 #define MAC_P_KEY 0x23
68 #define MAC_Q_KEY 0x0C
69 #define MAC_R_KEY 0x0F
70 #define MAC_S_KEY 0x01
71 #define MAC_T_KEY 0x11
72 #define MAC_U_KEY 0x20
73 #define MAC_V_KEY 0x09
74 #define MAC_W_KEY 0x0D
75 #define MAC_X_KEY 0x07
76 #define MAC_Y_KEY 0x10
77 #define MAC_Z_KEY 0x06
78 #define MAC_F1_KEY 0x7A
79 #define MAC_F2_KEY 0x78
80 #define MAC_F3_KEY 0x63
81 #define MAC_F4_KEY 0x76
82 #define MAC_F5_KEY 0x60
83 #define MAC_F6_KEY 0x61
84 #define MAC_F7_KEY 0x62
85 #define MAC_F8_KEY 0x64
86 #define MAC_F9_KEY 0x65
87 #define MAC_F10_KEY 0x6D
88 #define MAC_F11_KEY 0x67
89 #define MAC_F12_KEY 0x6F
90 #define MAC_RETURN_KEY 0x24
91 #define MAC_ENTER_KEY 0x4C
92 #define MAC_TAB_KEY 0x30
93 #define MAC_SPACE_KEY 0x31
94 #define MAC_DELETE_KEY 0x33
95 #define MAC_ESCAPE_KEY 0x35
96 #define MAC_COMMAND_KEY 0x37
97 #define MAC_SHIFT_KEY 0x38
98 #define MAC_CAPS_LOCK_KEY 0x39
99 #define MAC_OPTION_KEY 0x3A
100 #define MAC_CONTROL_KEY 0x3B
101 #define MAC_PAGE_UP_KEY 0x74
102 #define MAC_PAGE_DOWN_KEY 0x79
103 #define MAC_INSERT_KEY 0x72
104 #define MAC_DEL_KEY 0x75
105 #define MAC_HOME_KEY 0x73
106 #define MAC_END_KEY 0x77
107 #define MAC_LEFT_BRACKET_KEY 0x21
108 #define MAC_RIGHT_BRACKET_KEY 0x1E
109 #define MAC_ARROW_UP_KEY 0x7E
110 #define MAC_ARROW_DOWN_KEY 0x7D
111 #define MAC_ARROW_LEFT_KEY 0x7B
112 #define MAC_ARROW_RIGHT_KEY 0x7C
113 #define MAC_TILDE_KEY 0x32
114 #define MAC_MINUS_KEY 0x1B
115 #define MAC_PLUS_KEY 0x18
116 #define MAC_SLASH_KEY 0x2C
117 #define MAC_PERIOD_KEY 0x2F
118 #define MAC_COMMA_KEY 0x2B
119 #define MAC_BACKSLASH_KEY 0x2A
120 #define MAC_LEFTBRACKET_KEY 0x21
121 #define MAC_RIGHTBRACKET_KEY 0x1E
122 #define MAC_NUMPAD_CLEAR_KEY 0x47
123 #define MAC_NUMPAD_MINUS_KEY 0x4E
124 #define MAC_NUMPAD_EQUALS_KEY 0x51
125 #define MAC_NUMPAD_PLUS_KEY 0x45
126 #define MAC_NUMPAD_SLASH_KEY 0x4B
127 #define MAC_NUMPAD_ASTERISK_KEY 0x43
128 #define MAC_NUMPAD_ENTER_KEY 0x4C
129 #define MAC_NUMPAD_PERIOD_KEY 0x41
130 #define MAC_SEMICOLON_KEY 0x29
131 #define MAC_APOSTROPHE_KEY 0x27
132 #define MAC_MOUSEBUTTON1 10000
133 #define MAC_MOUSEBUTTON2 10001
135 #define UNKNOWN_KEY 0xFF
138 /**> FUNCTION PROTOTYPES <**/
139 Boolean IsKeyDown( unsigned char *keyMap, unsigned short theKey );
141 void MoveMouse(int xcoord, int ycoord, Point *mouseloc);
142 void RefreshMouse(Point *mouseloc);
144 unsigned short CharToKey(const char* which);
145 const char* KeyToChar(unsigned short which);
146 char KeyToSingleChar(unsigned short which);
147 char Shift(char which);
148 bool Compare(const char *thestring, const char *tocompare, int start, int end);
151 typedef unsigned char KeyMap[16];
152 void GetKeys( unsigned char theKeys[16]);