use SDL keycode for shortcuts (doesn't fix layout issues)
authorkoda
Sun, 17 Mar 2013 19:57:52 +0100
changeset 8746 55539c550c33
parent 8745 b3756c3f65e5
child 8747 878aa4c92424
use SDL keycode for shortcuts (doesn't fix layout issues)
hedgewars/SDLh.pas
hedgewars/uInputHandler.pas
--- a/hedgewars/SDLh.pas	Sun Mar 17 18:42:28 2013 +0100
+++ b/hedgewars/SDLh.pas	Sun Mar 17 19:57:52 2013 +0100
@@ -316,6 +316,8 @@
     SDLK_BACKSPACE = 8;
     SDLK_RETURN    = 13;
     SDLK_ESCAPE    = 27;
+    SDLK_q         = 113;
+    SDLK_w         = 119;
     SDLK_DELETE    = 127;
     SDLK_UP        = 273;
     SDLK_DOWN      = 274;
--- a/hedgewars/uInputHandler.pas	Sun Mar 17 18:42:28 2013 +0100
+++ b/hedgewars/uInputHandler.pas	Sun Mar 17 19:57:52 2013 +0100
@@ -58,7 +58,6 @@
     RCTRL  = $4000; 
 
 var tkbd: array[0..cKbdMaxIndex] of boolean;
-    quitKeyCode, closeKeyCode: Byte;
     KeyNames: array [0..cKeyMaxIndex] of string[15];
     CurrentBinds: TBinds;
     ControllerNumControllers: Integer;
@@ -138,7 +137,7 @@
           and (CurrentHedgehog^.BotLevel = 0);
 
 // ctrl/cmd + q to close engine and frontend
-if(KeyDown and (code = quitKeyCode)) then
+if(KeyDown and (code = SDLK_q)) then
     begin
 {$IFDEF DARWIN}
     if tkbd[KeyNameToCode('left_meta')] or tkbd[KeyNameToCode('right_meta')] then
@@ -149,7 +148,7 @@
     end;
 
 // ctrl/cmd + w to close engine
-if(KeyDown and (code = closeKeyCode)) then
+if(KeyDown and (code = SDLK_w)) then
     begin
 {$IFDEF DARWIN}
     // on OS X it this is expected behaviour
@@ -159,7 +158,7 @@
     if tkbd[KeyNameToCode('left_ctrl')] or tkbd[KeyNameToCode('right_ctrl')] then
         if ((CurrentBinds[KeyNameToCode('left_ctrl')] = '') or
             (CurrentBinds[KeyNameToCode('right_ctrl')] = '')) and
-            (CurrentBinds[closeKeyCode] = '') then
+            (CurrentBinds[SDLK_w] = '') then
 {$ENDIF}
         ParseCommand('forcequit', true);
     end;
@@ -242,8 +241,6 @@
         end;
     end;
 
-quitKeyCode:= KeyNameToCode(_S'q');
-closeKeyCode:= KeyNameToCode(_S'w');
 
 // get the size of keyboard array
 SDL_GetKeyState(@k);