hedgewars/uKeys.pas
changeset 2152 a2811690da1b
parent 2008 fc2fb5c938c3
child 2162 2bce91404d49
--- a/hedgewars/uKeys.pas	Mon Jun 08 16:35:29 2009 +0000
+++ b/hedgewars/uKeys.pas	Thu Jun 11 15:22:02 2009 +0000
@@ -62,11 +62,21 @@
           and (not CurrentTeam^.ExtDriven)
           and (CurrentHedgehog^.BotLevel = 0);
 
+{$IFDEF SDL13}
+pkbd:= SDL_GetKeyboardState(nil);
+{$ELSE}
 pkbd:= SDL_GetKeyState(nil);
+{$ENDIF}
 i:= SDL_GetMouseState(nil, nil);
 pkbd^[1]:= (i and 1);
 pkbd^[2]:= ((i shr 1) and 1);
+{$IFDEF DARWIN}
+//    normal right click     ||      ctrl (left/right) + left click	  
+pkbd^[3]:= ((i shr 2) and 1) or ((i and 1) and (pkbd^[306] or pkbd^[305]));
+{$ELSE}
 pkbd^[3]:= ((i shr 2) and 1);
+{$ENDIF}
+
 for i:= 1 to cKeyMaxIndex do
 if CurrentBinds[i][0] <> #0 then
 	begin
@@ -88,7 +98,11 @@
 var i, t: LongInt;
     pkbd: PByteArray;
 begin
+{$IFDEF SDL13}
+pkbd:= PByteArray(SDL_GetKeyboardState(@i));
+{$ELSE}
 pkbd:= PByteArray(SDL_GetKeyState(@i));
+{$ENDIF}
 TryDo(i < cKeyMaxIndex, 'SDL keys number is more than expected (' + inttostr(i) + ')', true);
 for t:= 0 to Pred(i) do
     tkbd[i]:= pkbd^[i]