hedgewars/uKeys.pas
changeset 2714 c85ffe57d971
parent 2699 249adefa9c1c
child 2716 b9ca1bfca24f
equal deleted inserted replaced
2713:71250942e95b 2714:c85ffe57d971
   106 // move cursor/camera
   106 // move cursor/camera
   107 // TODO: Scale on screen dimensions and/or axis value (game controller)?
   107 // TODO: Scale on screen dimensions and/or axis value (game controller)?
   108 movecursor(5 * CursorMovementX, 5 * CursorMovementY);
   108 movecursor(5 * CursorMovementX, 5 * CursorMovementY);
   109 
   109 
   110 k:= SDL_GetMouseState(nil, nil);
   110 k:= SDL_GetMouseState(nil, nil);
   111 {$IFDEF SDL13}
       
   112 pkbd:= SDL_GetKeyboardState(@j);
       
   113 {$ELSE}
       
   114 pkbd:= SDL_GetKeyState(@j);
   111 pkbd:= SDL_GetKeyState(@j);
   115 {$ENDIF}
       
   116 
   112 
   117 {$IFNDEF IPHONEOS}
   113 {$IFNDEF IPHONEOS}
   118 for i:= 6 to pred(j) do // first 6 will be overwritten
   114 for i:= 6 to pred(j) do // first 6 will be overwritten
   119 	tkbdn[i]:= pkbd^[i];
   115 	tkbdn[i]:= pkbd^[i];
   120 {$ENDIF}
   116 {$ENDIF}
   205 var i, j, k, t: LongInt;
   201 var i, j, k, t: LongInt;
   206     pkbd: PByteArray;
   202     pkbd: PByteArray;
   207 begin
   203 begin
   208 
   204 
   209 k:= SDL_GetMouseState(nil, nil);
   205 k:= SDL_GetMouseState(nil, nil);
   210 {$IFDEF SDL13}
       
   211 pkbd:= SDL_GetKeyboardState(@j);
       
   212 {$ELSE}
       
   213 pkbd:= SDL_GetKeyState(@j);
   206 pkbd:= SDL_GetKeyState(@j);
   214 {$ENDIF}
   207 
   215 TryDo(j < cKeyMaxIndex, 'SDL keys number is more than expected (' + inttostr(j) + ')', true);
   208 TryDo(j < cKeyMaxIndex, 'SDL keys number is more than expected (' + inttostr(j) + ')', true);
   216 
   209 
   217 {$IFNDEF IPHONEOS}
   210 {$IFNDEF IPHONEOS}
   218 for i:= 1 to pred(j) do
   211 for i:= 1 to pred(j) do
   219 	tkbdn[i]:= pkbd^[i];
   212 	tkbdn[i]:= pkbd^[i];
   310 end;
   303 end;
   311 
   304 
   312 //for i:= 0 to cKeyMaxIndex do writeln(stdout,inttostr(i) + ': ' + KeyNames[i]);
   305 //for i:= 0 to cKeyMaxIndex do writeln(stdout,inttostr(i) + ': ' + KeyNames[i]);
   313 
   306 
   314 // get the size of keyboard array
   307 // get the size of keyboard array
   315 {$IFDEF SDL13}
       
   316 SDL_GetKeyboardState(@k);
       
   317 {$ELSE}
       
   318 SDL_GetKeyState(@k);
   308 SDL_GetKeyState(@k);
   319 {$ENDIF}
       
   320 
   309 
   321 // Controller(s)
   310 // Controller(s)
   322 for j:= 0 to Pred(ControllerNumControllers) do
   311 for j:= 0 to Pred(ControllerNumControllers) do
   323 	begin
   312 	begin
   324 	for i:= 0 to Pred(ControllerNumAxes[j]) do
   313 	for i:= 0 to Pred(ControllerNumAxes[j]) do