--- a/hedgewars/uKeys.pas Sun Jan 16 13:53:32 2011 -0500
+++ b/hedgewars/uKeys.pas Mon Jan 17 23:22:52 2011 +0100
@@ -40,47 +40,10 @@
procedure ControllerHatEvent(joy, hat, value: Byte);
procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean);
-var hideAmmoMenu: boolean;
- wheelUp: boolean;
- wheelDown: boolean;
-
- ControllerNumControllers: Integer;
- ControllerEnabled: Integer;
- ControllerNumAxes: array[0..5] of Integer;
- //ControllerNumBalls: array[0..5] of Integer;
- ControllerNumHats: array[0..5] of Integer;
- ControllerNumButtons: array[0..5] of Integer;
- ControllerAxes: array[0..5] of array[0..19] of Integer;
- //ControllerBalls: array[0..5] of array[0..19] of array[0..1] of Integer;
- ControllerHats: array[0..5] of array[0..19] of Byte;
- ControllerButtons: array[0..5] of array[0..19] of Byte;
-
- DefaultBinds, CurrentBinds: TBinds;
-
- coeff: LongInt;
-{$IFDEF HWLIBRARY}
- leftClick: boolean;
- middleClick: boolean;
- rightClick: boolean;
-
- upKey: boolean;
- downKey: boolean;
- rightKey: boolean;
- leftKey: boolean;
- preciseKey: boolean;
-
- backspaceKey: boolean;
- spaceKey: boolean;
- enterKey: boolean;
- tabKey: boolean;
-
- chatAction: boolean;
- pauseAction: boolean;
-
{$IFDEF IPHONEOS}
procedure setiPhoneBinds;
{$ENDIF}
-{$ENDIF}
+
implementation
uses uConsole, uCommands, uMisc, uVariables, uConsts, uUtils, uDebug;
@@ -109,7 +72,7 @@
// move cursor/camera
// TODO: Scale on screen dimensions and/or axis value (game controller)?
-movecursor(coeff * CursorMovementX, coeff * CursorMovementY);
+movecursor(5 * CursorMovementX, 5 * CursorMovementY);
k:= SDL_GetMouseState(nil, nil);
@@ -139,8 +102,7 @@
{$IFDEF IPHONEOS}
setiPhoneBinds();
-{$ENDIF}
-
+{$ELSE}
// Controller(s)
k:= j; // should we test k for hitting the limit? sounds rather unlikely to ever reach it
for j:= 0 to Pred(ControllerNumControllers) do
@@ -165,6 +127,18 @@
inc(k, 1);
end;
end;
+{$ENDIF}
+
+// ctrl/cmd + w/q to close engine and/or frontend
+{$IFDEF DARWIN}
+ if ((tkbdn[KeyNameToCode('left_meta')] = 1) or (tkbdn[KeyNameToCode('right_meta')] = 1)) then
+{$ELSE}
+ if ((tkbdn[KeyNameToCode('left_ctrl')] = 1) or (tkbdn[KeyNameToCode('right_ctrl')] = 1)) then
+{$ENDIF}
+ begin
+ if tkbdn[KeyNameToCode('q')] = 1 then ParseCommand ('halt', true)
+ else if tkbdn[KeyNameToCode('w')] = 1 then ParseCommand ('forcequit', true);
+ end;
// now process strokes
for i:= 0 to cKeyMaxIndex do
@@ -222,8 +196,7 @@
{$IFDEF IPHONEOS}
setiPhoneBinds();
-{$ENDIF}
-
+{$ELSE}
// Controller(s)
k:= j; // should we test k for hitting the limit? sounds rather unlikely to ever reach it
for j:= 0 to Pred(ControllerNumControllers) do
@@ -248,6 +221,7 @@
inc(k, 1);
end;
end;
+{$ENDIF}
for t:= 0 to cKeyMaxIndex do
tkbd[i]:= tkbdn[i]
@@ -502,7 +476,6 @@
begin
wheelUp:= false;
wheelDown:= false;
- coeff:= 5;
{$IFDEF HWLIBRARY}
// this function is called by HW_allKeysUp so be careful