hedgewars/uInputHandler.pas
changeset 8370 0c79946e96f8
parent 8346 3443e0de2c9d
child 8444 75db7bb8dce8
child 8746 55539c550c33
equal deleted inserted replaced
8369:31033e521653 8370:0c79946e96f8
    65     ControllerEnabled: Integer;
    65     ControllerEnabled: Integer;
    66     ControllerNumAxes: array[0..5] of Integer;
    66     ControllerNumAxes: array[0..5] of Integer;
    67     //ControllerNumBalls: array[0..5] of Integer;
    67     //ControllerNumBalls: array[0..5] of Integer;
    68     ControllerNumHats: array[0..5] of Integer;
    68     ControllerNumHats: array[0..5] of Integer;
    69     ControllerNumButtons: array[0..5] of Integer;
    69     ControllerNumButtons: array[0..5] of Integer;
    70     ControllerAxes: array[0..5] of array[0..19] of Integer;
    70     //ControllerAxes: array[0..5] of array[0..19] of Integer;
    71     //ControllerBalls: array[0..5] of array[0..19] of array[0..1] of Integer;
    71     //ControllerBalls: array[0..5] of array[0..19] of array[0..1] of Integer;
    72     ControllerHats: array[0..5] of array[0..19] of Byte;
    72     //ControllerHats: array[0..5] of array[0..19] of Byte;
    73     ControllerButtons: array[0..5] of array[0..19] of Byte;
    73     //ControllerButtons: array[0..5] of array[0..19] of Byte;
    74     usingDBinds: boolean;
    74     usingDBinds: boolean;
    75 
    75 
    76 function  KeyNameToCode(name: shortstring): LongInt; inline;
    76 function  KeyNameToCode(name: shortstring): LongInt; inline;
    77 begin
    77 begin
    78     KeyNameToCode:= KeyNameToCode(name, '');
    78     KeyNameToCode:= KeyNameToCode(name, '');
   353 end;
   353 end;
   354 
   354 
   355 var Controller: array [0..5] of PSDL_Joystick;
   355 var Controller: array [0..5] of PSDL_Joystick;
   356 
   356 
   357 procedure ControllerInit;
   357 procedure ControllerInit;
   358 var i, j: Integer;
   358 var j: Integer;
   359 begin
   359 begin
   360 ControllerEnabled:= 0;
   360 ControllerEnabled:= 0;
   361 {$IFDEF IPHONE}
   361 {$IFDEF IPHONE}
   362 exit; // joystick subsystem disabled on iPhone
   362 exit; // joystick subsystem disabled on iPhone
   363 {$ENDIF}
   363 {$ENDIF}
   398                 ControllerNumHats[j]:= 20;
   398                 ControllerNumHats[j]:= 20;
   399                 
   399                 
   400             if ControllerNumButtons[j] > 20 then
   400             if ControllerNumButtons[j] > 20 then
   401                 ControllerNumButtons[j]:= 20;
   401                 ControllerNumButtons[j]:= 20;
   402 
   402 
   403             // reset all buttons/axes
   403             (*// reset all buttons/axes
   404             for i:= 0 to pred(ControllerNumAxes[j]) do
   404             for i:= 0 to pred(ControllerNumAxes[j]) do
   405                 ControllerAxes[j][i]:= 0;
   405                 ControllerAxes[j][i]:= 0;
   406             (*for i:= 0 to pred(ControllerNumBalls[j]) do
   406             for i:= 0 to pred(ControllerNumBalls[j]) do
   407                 begin
   407                 begin
   408                 ControllerBalls[j][i][0]:= 0;
   408                 ControllerBalls[j][i][0]:= 0;
   409                 ControllerBalls[j][i][1]:= 0;
   409                 ControllerBalls[j][i][1]:= 0;
   410                 end;*)
   410                 end;
   411             for i:= 0 to pred(ControllerNumHats[j]) do
   411             for i:= 0 to pred(ControllerNumHats[j]) do
   412                 ControllerHats[j][i]:= SDL_HAT_CENTERED;
   412                 ControllerHats[j][i]:= SDL_HAT_CENTERED;
   413             for i:= 0 to pred(ControllerNumButtons[j]) do
   413             for i:= 0 to pred(ControllerNumButtons[j]) do
   414                 ControllerButtons[j][i]:= 0;
   414                 ControllerButtons[j][i]:= 0;*)
   415             end;
   415             end;
   416         end;
   416         end;
   417     // enable event generation/controller updating
   417     // enable event generation/controller updating
   418     SDL_JoystickEventState(1);
   418     SDL_JoystickEventState(1);
   419     end
   419     end