Ignore:
Timestamp:
Aug 28, 2010, 7:19:11 PM (10 years ago)
Author:
sam
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/input.cpp

    r150 r176  
    4242    /* Simulate a joystick using the keyboard. This SDL call is free. */
    4343    Uint8 *keystate = SDL_GetKeyState(NULL);
    44     f.y -= keystate[SDLK_e];
    45     f.y += keystate[SDLK_d];
    46     f.x -= keystate[SDLK_s];
    47     f.x += keystate[SDLK_f];
    48     if (keystate[SDLK_e] + keystate[SDLK_d]
    49          == keystate[SDLK_s] + keystate[SDLK_f])
     44    int left = keystate[SDLK_d] - (keystate[SDLK_a] | keystate[SDLK_q]);
     45    int up = keystate[SDLK_s] - (keystate[SDLK_w] | keystate[SDLK_z]);
     46    f.y += up;
     47    f.x += left;
     48    if (left && up)
    5049    {
    5150        f.x *= invsqrt2;
Note: See TracChangeset for help on using the changeset viewer.