whatever: Joystick can can no longer be used with arrows to double speed

This commit is contained in:
Logen Kain 2016-11-12 22:28:07 -07:00
parent 565d2890be
commit cbc6417dfd

View File

@ -71,8 +71,6 @@ int main ( int argc, char *argv[] )
int xDir = 0;
int yDir = 0;
SDL_JoyButtonEvent jbutton;
/* message pump */
while (!gameover)
{
@ -140,9 +138,13 @@ int main ( int argc, char *argv[] )
/* move the player with the above input */
gPlayer_dest.x += xDir;
gPlayer_dest.y += yDir;
if (xDir != 0 || yDir != 0)
{
gPlayer_dest.x += (xDir * movement_speed);
gPlayer_dest.y += (yDir * movement_speed);
}
else
{
const Uint8* currentKeyStates = SDL_GetKeyboardState( NULL );
if (currentKeyStates[ SDL_SCANCODE_ESCAPE ] ||
currentKeyStates[ SDL_SCANCODE_Q ] )
@ -166,9 +168,7 @@ int main ( int argc, char *argv[] )
{
gPlayer_dest.y += movement_speed;
}
}
/* render the background */
SDL_RenderCopy(gRenderer, gBackground_texture, NULL, NULL);
@ -179,10 +179,7 @@ int main ( int argc, char *argv[] )
/* Render here */
SDL_RenderPresent(gRenderer);
}
return 0;
}
int init()