Parcourir la source

Switch from esdf controls to wasd, but support qwerty and azerty keyboards.

legacy
Sam Hocevar sam il y a 14 ans
Parent
révision
887e7b1690
1 fichiers modifiés avec 5 ajouts et 6 suppressions
  1. +5
    -6
      src/input.cpp

+ 5
- 6
src/input.cpp Voir le fichier

@@ -41,12 +41,11 @@ Float2 Input::GetAxis(int axis)

/* Simulate a joystick using the keyboard. This SDL call is free. */
Uint8 *keystate = SDL_GetKeyState(NULL);
f.y -= keystate[SDLK_e];
f.y += keystate[SDLK_d];
f.x -= keystate[SDLK_s];
f.x += keystate[SDLK_f];
if (keystate[SDLK_e] + keystate[SDLK_d]
== keystate[SDLK_s] + keystate[SDLK_f])
int left = keystate[SDLK_d] - (keystate[SDLK_a] | keystate[SDLK_q]);
int up = keystate[SDLK_s] - (keystate[SDLK_w] | keystate[SDLK_z]);
f.y += up;
f.x += left;
if (left && up)
{
f.x *= invsqrt2;
f.y *= invsqrt2;


Chargement…
Annuler
Enregistrer