hedgewars/uKeys.pas
branchhedgeroid
changeset 7855 ddcdedd3330b
parent 6350 41b0a9955c47
parent 7854 0b447175594f
child 7857 2bc61f8841a1
equal deleted inserted replaced
6350:41b0a9955c47 7855:ddcdedd3330b
     1 (*
       
     2  * Hedgewars, a free turn based strategy game
       
     3  * Copyright (c) 2004-2011 Andrey Korotaev <unC0Rr@gmail.com>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation; version 2 of the License
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
       
    17  *)
       
    18 
       
    19 {$INCLUDE "options.inc"}
       
    20 
       
    21 unit uKeys;
       
    22 interface
       
    23 uses SDLh, uTypes;
       
    24 
       
    25 procedure initModule;
       
    26 procedure freeModule;
       
    27 
       
    28 function  KeyNameToCode(name: shortstring): word;
       
    29 procedure ProcessKbd;
       
    30 procedure ResetKbd;
       
    31 procedure FreezeEnterKey;
       
    32 procedure InitKbdKeyTable;
       
    33 
       
    34 procedure SetBinds(var binds: TBinds);
       
    35 procedure SetDefaultBinds;
       
    36 
       
    37 procedure ControllerInit;
       
    38 procedure ControllerClose;
       
    39 procedure ControllerAxisEvent(joy, axis: Byte; value: Integer);
       
    40 procedure ControllerHatEvent(joy, hat, value: Byte);
       
    41 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean);
       
    42 
       
    43 {$IFDEF IPHONEOS}
       
    44 procedure setiPhoneBinds;
       
    45 {$ENDIF}
       
    46 
       
    47 implementation
       
    48 uses uConsole, uCommands, uMisc, uVariables, uConsts, uUtils, uDebug;
       
    49 
       
    50 var tkbd, tkbdn: TKeyboardState;
       
    51     KeyNames: array [0..cKeyMaxIndex] of string[15];
       
    52 
       
    53 function KeyNameToCode(name: shortstring): word;
       
    54 var code: Word;
       
    55 begin
       
    56     code:= cKeyMaxIndex;
       
    57     while (code > 0) and (KeyNames[code] <> name) do dec(code);
       
    58     KeyNameToCode:= code;
       
    59 end;
       
    60 
       
    61 
       
    62 procedure ProcessKbd;
       
    63 var  i, j, k: LongInt;
       
    64      s: shortstring;
       
    65      Trusted: boolean;
       
    66 {$IFNDEF IPHONEOS}pkbd: PByteArray;{$ENDIF}
       
    67 begin
       
    68 hideAmmoMenu:= false;
       
    69 Trusted:= (CurrentTeam <> nil)
       
    70           and (not CurrentTeam^.ExtDriven)
       
    71           and (CurrentHedgehog^.BotLevel = 0);
       
    72 
       
    73 // move cursor/camera
       
    74 // TODO: Scale on screen dimensions and/or axis value (game controller)?
       
    75 movecursor(5 * CursorMovementX, 5 * CursorMovementY);
       
    76 
       
    77 k:= SDL_GetMouseState(nil, nil);
       
    78 
       
    79 {$IFDEF IPHONEOS}
       
    80 SDL_GetKeyState(@j);
       
    81 {$ELSE}
       
    82 pkbd:= SDL_GetKeyState(@j);
       
    83 for i:= 6 to pred(j) do // first 6 will be overwritten
       
    84     tkbdn[i]:= pkbd^[i];
       
    85 {$ENDIF}
       
    86 
       
    87 // mouse buttons
       
    88 {$IFDEF DARWIN}
       
    89 tkbdn[1]:= ((k and 1) and not (tkbdn[306] or tkbdn[305]));
       
    90 tkbdn[3]:= ((k and 1) and (tkbdn[306] or tkbdn[305])) or (k and 4);
       
    91 {$ELSE}
       
    92 tkbdn[1]:= (k and 1);
       
    93 tkbdn[3]:= ((k shr 2) and 1);
       
    94 {$ENDIF}
       
    95 tkbdn[2]:= ((k shr 1) and 1);
       
    96 
       
    97 // mouse wheels
       
    98 tkbdn[4]:= ord(wheelDown);
       
    99 tkbdn[5]:= ord(wheelUp);
       
   100 wheelUp:= false;
       
   101 wheelDown:= false;
       
   102 
       
   103 {$IFDEF IPHONEOS}
       
   104 setiPhoneBinds();
       
   105 {$ELSE}
       
   106 // Controller(s)
       
   107 k:= j; // should we test k for hitting the limit? sounds rather unlikely to ever reach it
       
   108 for j:= 0 to Pred(ControllerNumControllers) do
       
   109     begin
       
   110     for i:= 0 to Pred(ControllerNumAxes[j]) do
       
   111         begin
       
   112         if ControllerAxes[j][i] > 20000 then tkbdn[k + 0]:= 1 else tkbdn[k + 0]:= 0;
       
   113         if ControllerAxes[j][i] < -20000 then tkbdn[k + 1]:= 1 else tkbdn[k + 1]:= 0;
       
   114         inc(k, 2);
       
   115         end;
       
   116     for i:= 0 to Pred(ControllerNumHats[j]) do
       
   117         begin
       
   118         tkbdn[k + 0]:= ControllerHats[j][i] and SDL_HAT_UP;
       
   119         tkbdn[k + 1]:= ControllerHats[j][i] and SDL_HAT_RIGHT;
       
   120         tkbdn[k + 2]:= ControllerHats[j][i] and SDL_HAT_DOWN;
       
   121         tkbdn[k + 3]:= ControllerHats[j][i] and SDL_HAT_LEFT;
       
   122         inc(k, 4);
       
   123         end;
       
   124     for i:= 0 to Pred(ControllerNumButtons[j]) do
       
   125         begin
       
   126         tkbdn[k]:= ControllerButtons[j][i];
       
   127         inc(k, 1);
       
   128         end;
       
   129     end;
       
   130 {$ENDIF}
       
   131 
       
   132 // ctrl/cmd + q to close engine and frontend
       
   133 {$IFDEF DARWIN}
       
   134     if ((tkbdn[KeyNameToCode('left_meta')] = 1) or (tkbdn[KeyNameToCode('right_meta')] = 1)) then
       
   135 {$ELSE}
       
   136     if ((tkbdn[KeyNameToCode('left_ctrl')] = 1) or (tkbdn[KeyNameToCode('right_ctrl')] = 1)) then
       
   137 {$ENDIF}
       
   138     begin
       
   139         if tkbdn[KeyNameToCode('q')] = 1 then ParseCommand ('halt', true)
       
   140     end;
       
   141 
       
   142 // now process strokes
       
   143 for i:= 0 to cKeyMaxIndex do
       
   144 if CurrentBinds[i][0] <> #0 then
       
   145     begin
       
   146     if (i > 3) and (tkbdn[i] <> 0) and not ((CurrentBinds[i] = 'put') or (CurrentBinds[i] = 'ammomenu') or (CurrentBinds[i] = '+cur_u') or (CurrentBinds[i] = '+cur_d') or (CurrentBinds[i] = '+cur_l') or (CurrentBinds[i] = '+cur_r')) then hideAmmoMenu:= true;
       
   147     if (tkbd[i] = 0) and (tkbdn[i] <> 0) then
       
   148          begin
       
   149          ParseCommand(CurrentBinds[i], Trusted);
       
   150          if (CurrentTeam <> nil) and not CurrentTeam^.ExtDriven and (ReadyTimeLeft > 1) then ParseCommand('gencmd R', true)
       
   151          end
       
   152     else if (CurrentBinds[i][1] = '+')
       
   153             and (tkbdn[i] = 0)
       
   154             and (tkbd[i] <> 0) then
       
   155             begin
       
   156             s:= CurrentBinds[i];
       
   157             s[1]:= '-';
       
   158             ParseCommand(s, Trusted);
       
   159             if (CurrentTeam <> nil) and not CurrentTeam^.ExtDriven and (ReadyTimeLeft > 1) then ParseCommand('gencmd R', true)
       
   160             end;
       
   161     tkbd[i]:= tkbdn[i]
       
   162     end
       
   163 end;
       
   164 
       
   165 procedure ResetKbd;
       
   166 var j, k, t: LongInt;
       
   167 {$IFNDEF IPHONEOS}
       
   168     i: LongInt;
       
   169     pkbd: PByteArray;
       
   170 {$ENDIF}
       
   171 begin
       
   172 
       
   173 k:= SDL_GetMouseState(nil, nil);
       
   174 {$IFNDEF IPHONEOS}pkbd:={$ENDIF}SDL_GetKeyState(@j);
       
   175 
       
   176 TryDo(j < cKeyMaxIndex, 'SDL keys number is more than expected (' + IntToStr(j) + ')', true);
       
   177 
       
   178 {$IFNDEF IPHONEOS}
       
   179 for i:= 1 to pred(j) do
       
   180     tkbdn[i]:= pkbd^[i];
       
   181 {$ENDIF}
       
   182 
       
   183 // mouse buttons
       
   184 {$IFDEF DARWIN}
       
   185 tkbdn[1]:= ((k and 1) and not (tkbdn[306] or tkbdn[305]));
       
   186 tkbdn[3]:= ((k and 1) and (tkbdn[306] or tkbdn[305])) or (k and 4);
       
   187 {$ELSE}
       
   188 tkbdn[1]:= (k and 1);
       
   189 tkbdn[3]:= ((k shr 2) and 1);
       
   190 {$ENDIF}
       
   191 tkbdn[2]:= ((k shr 1) and 1);
       
   192 
       
   193 // mouse wheels
       
   194 tkbdn[4]:= ord(wheelDown);
       
   195 tkbdn[5]:= ord(wheelUp);
       
   196 wheelUp:= false;
       
   197 wheelDown:= false;
       
   198 
       
   199 {$IFDEF IPHONEOS}
       
   200 setiPhoneBinds();
       
   201 {$ELSE}
       
   202 // Controller(s)
       
   203 k:= j; // should we test k for hitting the limit? sounds rather unlikely to ever reach it
       
   204 for j:= 0 to Pred(ControllerNumControllers) do
       
   205     begin
       
   206     for i:= 0 to Pred(ControllerNumAxes[j]) do
       
   207         begin
       
   208         if ControllerAxes[j][i] > 20000 then tkbdn[k + 0]:= 1 else tkbdn[k + 0]:= 0;
       
   209         if ControllerAxes[j][i] < -20000 then tkbdn[k + 1]:= 1 else tkbdn[k + 1]:= 0;
       
   210         inc(k, 2);
       
   211         end;
       
   212     for i:= 0 to Pred(ControllerNumHats[j]) do
       
   213         begin
       
   214         tkbdn[k + 0]:= ControllerHats[j][i] and SDL_HAT_UP;
       
   215         tkbdn[k + 1]:= ControllerHats[j][i] and SDL_HAT_RIGHT;
       
   216         tkbdn[k + 2]:= ControllerHats[j][i] and SDL_HAT_DOWN;
       
   217         tkbdn[k + 3]:= ControllerHats[j][i] and SDL_HAT_LEFT;
       
   218         inc(k, 4);
       
   219         end;
       
   220     for i:= 0 to Pred(ControllerNumButtons[j]) do
       
   221         begin
       
   222         tkbdn[k]:= ControllerButtons[j][i];
       
   223         inc(k, 1);
       
   224         end;
       
   225     end;
       
   226 {$ENDIF}
       
   227 
       
   228 // what is this final loop for?
       
   229 for t:= 0 to cKeyMaxIndex do
       
   230     tkbd[t]:= tkbdn[t]
       
   231 end;
       
   232 
       
   233 procedure InitKbdKeyTable;
       
   234 var i, j, k, t: LongInt;
       
   235     s: string[15];
       
   236 begin
       
   237 KeyNames[1]:= 'mousel';
       
   238 KeyNames[2]:= 'mousem';
       
   239 KeyNames[3]:= 'mouser';
       
   240 KeyNames[4]:= 'wheelup';
       
   241 KeyNames[5]:= 'wheeldown';
       
   242 
       
   243 for i:= 6 to cKeyMaxIndex do
       
   244     begin
       
   245     s:= shortstring(sdl_getkeyname(i));
       
   246     //writeln(stdout,IntToStr(i) + ': ' + s);
       
   247     if s = 'unknown key' then KeyNames[i]:= ''
       
   248     else 
       
   249         begin
       
   250         for t:= 1 to Length(s) do
       
   251             if s[t] = ' ' then s[t]:= '_';
       
   252         KeyNames[i]:= s
       
   253         end;
       
   254     end;
       
   255 
       
   256 //for i:= 0 to cKeyMaxIndex do writeln(stdout,IntToStr(i) + ': ' + KeyNames[i]);
       
   257 
       
   258 // get the size of keyboard array
       
   259 SDL_GetKeyState(@k);
       
   260 
       
   261 // Controller(s)
       
   262 for j:= 0 to Pred(ControllerNumControllers) do
       
   263     begin
       
   264     for i:= 0 to Pred(ControllerNumAxes[j]) do
       
   265         begin
       
   266         keynames[k + 0]:= 'j' + IntToStr(j) + 'a' + IntToStr(i) + 'u';
       
   267         keynames[k + 1]:= 'j' + IntToStr(j) + 'a' + IntToStr(i) + 'd';
       
   268         inc(k, 2);
       
   269         end;
       
   270     for i:= 0 to Pred(ControllerNumHats[j]) do
       
   271         begin
       
   272         keynames[k + 0]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'u';
       
   273         keynames[k + 1]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'r';
       
   274         keynames[k + 2]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'd';
       
   275         keynames[k + 3]:= 'j' + IntToStr(j) + 'h' + IntToStr(i) + 'l';
       
   276         inc(k, 4);
       
   277         end;
       
   278     for i:= 0 to Pred(ControllerNumButtons[j]) do
       
   279         begin
       
   280         keynames[k]:= 'j' + IntToStr(j) + 'b' + IntToStr(i);
       
   281         inc(k, 1);
       
   282         end;
       
   283     end;
       
   284 
       
   285 DefaultBinds[ 27]:= 'quit';
       
   286 DefaultBinds[ 96]:= 'history';
       
   287 DefaultBinds[127]:= 'rotmask';
       
   288 
       
   289 //numpad
       
   290 //DefaultBinds[265]:= '+volup';
       
   291 //DefaultBinds[256]:= '+voldown';
       
   292 
       
   293 DefaultBinds[KeyNameToCode('0')]:= '+volup';
       
   294 DefaultBinds[KeyNameToCode('9')]:= '+voldown';
       
   295 DefaultBinds[KeyNameToCode('c')]:= 'capture';
       
   296 DefaultBinds[KeyNameToCode('h')]:= 'findhh';
       
   297 DefaultBinds[KeyNameToCode('p')]:= 'pause';
       
   298 DefaultBinds[KeyNameToCode('s')]:= '+speedup';
       
   299 DefaultBinds[KeyNameToCode('t')]:= 'chat';
       
   300 DefaultBinds[KeyNameToCode('y')]:= 'confirm';
       
   301 
       
   302 DefaultBinds[KeyNameToCode('mousem')]:= 'zoomreset';
       
   303 DefaultBinds[KeyNameToCode('wheelup')]:= 'zoomout';
       
   304 DefaultBinds[KeyNameToCode('wheeldown')]:= 'zoomin';
       
   305 
       
   306 DefaultBinds[KeyNameToCode('f12')]:= 'fullscr';
       
   307 
       
   308 
       
   309 DefaultBinds[ 1]:= '/put';
       
   310 DefaultBinds[ 3]:= 'ammomenu';
       
   311 DefaultBinds[ 8]:= 'hjump';
       
   312 DefaultBinds[ 9]:= 'switch';
       
   313 DefaultBinds[13]:= 'ljump';
       
   314 DefaultBinds[32]:= '+attack';
       
   315 {$IFDEF IPHONEOS}
       
   316 DefaultBinds[23]:= '+up';
       
   317 DefaultBinds[24]:= '+down';
       
   318 DefaultBinds[25]:= '+left';
       
   319 DefaultBinds[26]:= '+right';
       
   320 DefaultBinds[27]:= '+precise';
       
   321 DefaultBinds[44]:= 'chat';
       
   322 DefaultBinds[55]:= 'pause';
       
   323 {$ELSE}
       
   324 DefaultBinds[KeyNameToCode('up')]:= '+up';
       
   325 DefaultBinds[KeyNameToCode('down')]:= '+down';
       
   326 DefaultBinds[KeyNameToCode('left')]:= '+left';
       
   327 DefaultBinds[KeyNameToCode('right')]:= '+right';
       
   328 DefaultBinds[KeyNameToCode('left_shift')]:= '+precise';
       
   329 {$ENDIF}
       
   330 
       
   331 for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+IntToStr(i);
       
   332 
       
   333 SetDefaultBinds();
       
   334 end;
       
   335 
       
   336 procedure SetBinds(var binds: TBinds);
       
   337 begin
       
   338 {$IFDEF IPHONEOS}
       
   339     binds:= binds; // avoid hint
       
   340     CurrentBinds:= DefaultBinds;
       
   341 {$ELSE}
       
   342     CurrentBinds:= binds;
       
   343 {$ENDIF}
       
   344 end;
       
   345 
       
   346 procedure SetDefaultBinds;
       
   347 begin
       
   348     CurrentBinds:= DefaultBinds;
       
   349 end;
       
   350 
       
   351 {$IFDEF IPHONEOS}
       
   352 procedure setiPhoneBinds;
       
   353 begin
       
   354     tkbdn[ 1]:= ord(leftClick);
       
   355     tkbdn[ 2]:= ord(middleClick);
       
   356     tkbdn[ 3]:= ord(rightClick);
       
   357 
       
   358     tkbdn[23]:= ord(upKey);
       
   359     tkbdn[24]:= ord(downKey);
       
   360     tkbdn[25]:= ord(leftKey);
       
   361     tkbdn[26]:= ord(rightKey);
       
   362     tkbdn[27]:= ord(preciseKey);
       
   363 
       
   364     tkbdn[ 8]:= ord(backspaceKey);
       
   365     tkbdn[ 9]:= ord(tabKey);
       
   366     tkbdn[13]:= ord(enterKey);
       
   367     tkbdn[32]:= ord(spaceKey);
       
   368 
       
   369     tkbdn[44]:= ord(chatAction);
       
   370     tkbdn[55]:= ord(pauseAction);
       
   371 
       
   372     // set to false the keys that only need one stoke
       
   373     leftClick:= false;
       
   374     middleClick:= false;
       
   375     rightClick:= false;
       
   376 
       
   377     tabKey:= false;
       
   378     enterKey:= false;
       
   379     backspaceKey:= false;
       
   380 
       
   381     chatAction:= false;
       
   382     pauseAction:= false;
       
   383 end;
       
   384 {$ENDIF}
       
   385 
       
   386 procedure FreezeEnterKey;
       
   387 begin
       
   388     tkbd[3]:= 1;
       
   389     tkbd[13]:= 1;
       
   390     tkbd[27]:= 1;
       
   391     tkbd[271]:= 1;
       
   392 end;
       
   393 
       
   394 var Controller: array [0..5] of PSDL_Joystick;
       
   395 
       
   396 procedure ControllerInit;
       
   397 var i, j: Integer;
       
   398 begin
       
   399 ControllerEnabled:= 0;
       
   400 {$IFDEF IPHONEOS}
       
   401 exit; // joystick subsystem disabled on iPhone
       
   402 {$ENDIF}
       
   403 
       
   404 SDL_InitSubSystem(SDL_INIT_JOYSTICK);
       
   405 ControllerNumControllers:= SDL_NumJoysticks();
       
   406 if ControllerNumControllers > 6 then ControllerNumControllers:= 6;
       
   407 
       
   408 WriteLnToConsole('Number of game controllers: ' + IntToStr(ControllerNumControllers));
       
   409 
       
   410 if ControllerNumControllers > 0 then
       
   411     begin
       
   412     for j:= 0 to pred(ControllerNumControllers) do
       
   413         begin
       
   414         WriteLnToConsole('Using game controller: ' + SDL_JoystickName(j));
       
   415         Controller[j]:= SDL_JoystickOpen(j);
       
   416         if Controller[j] = nil then
       
   417             WriteLnToConsole('* Failed to open game controller!')
       
   418         else
       
   419             begin
       
   420             ControllerNumAxes[j]:= SDL_JoystickNumAxes(Controller[j]);
       
   421             //ControllerNumBalls[j]:= SDL_JoystickNumBalls(Controller[j]);
       
   422             ControllerNumHats[j]:= SDL_JoystickNumHats(Controller[j]);
       
   423             ControllerNumButtons[j]:= SDL_JoystickNumButtons(Controller[j]);
       
   424             WriteLnToConsole('* Number of axes: ' + IntToStr(ControllerNumAxes[j]));
       
   425             //WriteLnToConsole('* Number of balls: ' + IntToStr(ControllerNumBalls[j]));
       
   426             WriteLnToConsole('* Number of hats: ' + IntToStr(ControllerNumHats[j]));
       
   427             WriteLnToConsole('* Number of buttons: ' + IntToStr(ControllerNumButtons[j]));
       
   428             ControllerEnabled:= 1;
       
   429 
       
   430             if ControllerNumAxes[j] > 20 then ControllerNumAxes[j]:= 20;
       
   431             //if ControllerNumBalls[j] > 20 then ControllerNumBalls[j]:= 20;
       
   432             if ControllerNumHats[j] > 20 then ControllerNumHats[j]:= 20;
       
   433             if ControllerNumButtons[j] > 20 then ControllerNumButtons[j]:= 20;
       
   434 
       
   435             // reset all buttons/axes
       
   436             for i:= 0 to pred(ControllerNumAxes[j]) do
       
   437                 ControllerAxes[j][i]:= 0;
       
   438             (*for i:= 0 to pred(ControllerNumBalls[j]) do
       
   439                 begin
       
   440                 ControllerBalls[j][i][0]:= 0;
       
   441                 ControllerBalls[j][i][1]:= 0;
       
   442                 end;*)
       
   443             for i:= 0 to pred(ControllerNumHats[j]) do
       
   444                 ControllerHats[j][i]:= SDL_HAT_CENTERED;
       
   445             for i:= 0 to pred(ControllerNumButtons[j]) do
       
   446                 ControllerButtons[j][i]:= 0;
       
   447             end;
       
   448         end;
       
   449     // enable event generation/controller updating
       
   450     SDL_JoystickEventState(1);
       
   451     end
       
   452 else
       
   453     WriteLnToConsole('Not using any game controller');
       
   454 end;
       
   455 
       
   456 procedure ControllerClose;
       
   457 var j: Integer;
       
   458 begin
       
   459     if ControllerEnabled > 0 then
       
   460         for j:= 0 to pred(ControllerNumControllers) do
       
   461             SDL_JoystickClose(Controller[j]);
       
   462 end;
       
   463 
       
   464 procedure ControllerAxisEvent(joy, axis: Byte; value: Integer);
       
   465 begin
       
   466     ControllerAxes[joy][axis]:= value;
       
   467 end;
       
   468 
       
   469 procedure ControllerHatEvent(joy, hat, value: Byte);
       
   470 begin
       
   471     ControllerHats[joy][hat]:= value;
       
   472 end;
       
   473 
       
   474 procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean);
       
   475 begin
       
   476     if pressed then ControllerButtons[joy][button]:= 1
       
   477     else ControllerButtons[joy][button]:= 0;
       
   478 end;
       
   479 
       
   480 procedure initModule;
       
   481 begin
       
   482     wheelUp:= false;
       
   483     wheelDown:= false;
       
   484 {$IFDEF HWLIBRARY}
       
   485     // this function is called by HW_allKeysUp so be careful
       
   486 
       
   487     // mouse emulation
       
   488     leftClick:= false;
       
   489     middleClick:= false;
       
   490     rightClick:= false;
       
   491 
       
   492     // arrow key emulation
       
   493     upKey:= false;
       
   494     downKey:= false;
       
   495     rightKey:= false;
       
   496     leftKey:= false;
       
   497     preciseKey:= false;
       
   498 
       
   499     // action key emulation
       
   500     backspaceKey:= false;
       
   501     spaceKey:= false;
       
   502     enterKey:= false;
       
   503     tabKey:= false;
       
   504 
       
   505     // other key emulation
       
   506     chatAction:= false;
       
   507     pauseAction:= false;
       
   508 {$ENDIF}
       
   509 end;
       
   510 
       
   511 procedure freeModule;
       
   512 begin
       
   513 
       
   514 end;
       
   515 
       
   516 end.