hedgewars/uInputHandler.pas
branchqmlfrontend
changeset 12855 1b2b84315d27
parent 11699 83c40c1eb0e7
parent 12790 abc9a99418cc
equal deleted inserted replaced
11843:01f88c3b7b66 12855:1b2b84315d27
    28 function  KeyNameToCode(name: shortstring): LongInt; inline;
    28 function  KeyNameToCode(name: shortstring): LongInt; inline;
    29 function  KeyNameToCode(name: shortstring; Modifier: shortstring): LongInt;
    29 function  KeyNameToCode(name: shortstring; Modifier: shortstring): LongInt;
    30 //procedure MaskModifier(var code: LongInt; modifier: LongWord);
    30 //procedure MaskModifier(var code: LongInt; modifier: LongWord);
    31 procedure MaskModifier(Modifier: shortstring; var code: LongInt);
    31 procedure MaskModifier(Modifier: shortstring; var code: LongInt);
    32 procedure ProcessMouse(event: TSDL_MouseButtonEvent; ButtonDown: boolean);
    32 procedure ProcessMouse(event: TSDL_MouseButtonEvent; ButtonDown: boolean);
    33 procedure ProcessMouseWheel(x, y: LongInt);
    33 //procedure ProcessMouseWheel(x, y: LongInt);
       
    34 procedure ProcessMouseWheel(y: LongInt);
    34 procedure ProcessKey(event: TSDL_KeyboardEvent); inline;
    35 procedure ProcessKey(event: TSDL_KeyboardEvent); inline;
    35 procedure ProcessKey(code: LongInt; KeyDown: boolean);
    36 procedure ProcessKey(code: LongInt; KeyDown: boolean);
    36 
    37 
    37 procedure ResetKbd;
    38 procedure ResetKbd;
    38 procedure ResetMouseWheel;
    39 procedure ResetMouseWheel;
   170 
   171 
   171 if CurrentBinds[code][0] <> #0 then
   172 if CurrentBinds[code][0] <> #0 then
   172     begin
   173     begin
   173     if (code < cKeyMaxIndex - 2) // means not mouse buttons
   174     if (code < cKeyMaxIndex - 2) // means not mouse buttons
   174         and KeyDown
   175         and KeyDown
   175         and (not ((CurrentBinds[code] = 'put')) or (CurrentBinds[code] = 'ammomenu') or (CurrentBinds[code] = '+cur_u') or (CurrentBinds[code] = '+cur_d') or (CurrentBinds[code] = '+cur_l') or (CurrentBinds[code] = '+cur_r')) 
   176         and (not ((CurrentBinds[code] = 'put') or (CurrentBinds[code] = 'ammomenu') or (CurrentBinds[code] = '+cur_u') or (CurrentBinds[code] = '+cur_d') or (CurrentBinds[code] = '+cur_l') or (CurrentBinds[code] = '+cur_r')))
   176         and (CurrentTeam <> nil) 
   177         and (CurrentTeam <> nil) 
   177         and (not CurrentTeam^.ExtDriven) 
   178         and (not CurrentTeam^.ExtDriven) 
   178         then bShowAmmoMenu:= false;
   179         then bShowAmmoMenu:= false;
   179 
   180 
   180     if KeyDown then
   181     if KeyDown then
   230         end;
   231         end;
   231 end;
   232 end;
   232 
   233 
   233 var mwheelupCode, mwheeldownCode: Integer;
   234 var mwheelupCode, mwheeldownCode: Integer;
   234 
   235 
   235 procedure ProcessMouseWheel(x, y: LongInt);
   236 //procedure ProcessMouseWheel(x, y: LongInt);
   236 begin
   237 procedure ProcessMouseWheel(y: LongInt);
       
   238 begin
       
   239     // we don't use 
   237     //writelntoconsole('[MOUSEWHEEL] '+inttostr(x)+', '+inttostr(y));
   240     //writelntoconsole('[MOUSEWHEEL] '+inttostr(x)+', '+inttostr(y));
   238     if y > 0 then
   241     if y > 0 then
   239         begin
   242         begin
   240         // reset other direction
   243         // reset other direction
   241         if tkbd[mwheeldownCode] then
   244         if tkbd[mwheeldownCode] then
   319     DefaultBinds[KeyNameToCode('j0a1u')]:= '+up';
   322     DefaultBinds[KeyNameToCode('j0a1u')]:= '+up';
   320     DefaultBinds[KeyNameToCode('j0a1d')]:= '+down';
   323     DefaultBinds[KeyNameToCode('j0a1d')]:= '+down';
   321     for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+char(48+i);
   324     for i:= 1 to 10 do DefaultBinds[KeyNameToCode('f'+IntToStr(i))]:= 'slot '+char(48+i);
   322     for i:= 1 to 5  do DefaultBinds[KeyNameToCode(IntToStr(i))]:= 'timer '+IntToStr(i);
   325     for i:= 1 to 5  do DefaultBinds[KeyNameToCode(IntToStr(i))]:= 'timer '+IntToStr(i);
   323 
   326 
   324     loadBinds('dbind', cPathz[ptData] + '/settings.ini');
   327     loadBinds('dbind', cPathz[ptConfig] + '/settings.ini');
   325 end;
   328 end;
   326 
   329 
   327 
   330 
   328 procedure InitKbdKeyTable;
   331 procedure InitKbdKeyTable;
   329 var i, j, k, t: LongInt;
   332 var i, j, k, t: LongInt;