diff -r e7e87e3c67db -r c6597b65caea hedgewars/uKeys.pas --- a/hedgewars/uKeys.pas Sun Oct 25 23:52:36 2009 +0000 +++ b/hedgewars/uKeys.pas Mon Oct 26 10:39:20 2009 +0000 @@ -18,7 +18,7 @@ unit uKeys; interface -uses uConsts; +uses uConsts, SDLh; {$INCLUDE options.inc} type TBinds = array[0..cKeyMaxIndex] of shortstring; @@ -39,7 +39,7 @@ procedure ControllerHatEvent(joy, hat, value: Byte); procedure ControllerButtonEvent(joy, button: Byte; pressed: Boolean); -var hideAmmoMenu: boolean; +var hideAmmoMenu: boolean; wheelUp: boolean = false; wheelDown: boolean = false; {$IFDEF TOUCHINPUT} @@ -47,24 +47,26 @@ middleClick: boolean = false; rightClick: boolean = false; -upKey: boolean = false; -downKey: boolean = false; -rightKey: boolean = false; -leftKey: boolean = false; + upKey: boolean = false; + downKey: boolean = false; + rightKey: boolean = false; + leftKey: boolean = false; -backspaceKey: boolean = false; -spaceKey: boolean = false; -enterKey: boolean = false; -tabKey: boolean = false; + backspaceKey: boolean = false; + spaceKey: boolean = false; + enterKey: boolean = false; + tabKey: boolean = false; -isAttacking: boolean = false; -isWalking: boolean = false; - + isAttacking: boolean = false; + isWalking: boolean = false; +{$ENDIF} +{$IFDEF IPHONEOS} + theJoystick: PSDL_Joystick; {$ENDIF} ControllerNumControllers: Integer; - ControllerEnabled: Integer; - ControllerNumAxes: array[0..5] of Integer; - //ControllerNumBalls: array[0..5] of 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; @@ -73,7 +75,7 @@ ControllerButtons: array[0..5] of array[0..19] of Byte; implementation -uses SDLh, uTeams, uConsole, uMisc, uStore; +uses uTeams, uConsole, uMisc, uStore; const KeyNumber = 1024; var tkbd, tkbdn: TKeyboardState; @@ -400,7 +402,7 @@ tkbd[271]:= 1; end; -var Controller: array [0..5] of PSDLJoystick; +var Controller: array [0..5] of PSDL_Joystick; procedure ControllerInit; var i, j: Integer; @@ -456,6 +458,9 @@ end else WriteLnToConsole('Not using any game controller'); +{$IFDEF IPHONEOS} +theJoystick:= Controller[0]; +{$ENDIF} end; procedure ControllerClose;