From 04033b332eae8be2e5a91023c2ac1384e333c239 Mon Sep 17 00:00:00 2001 From: Julie Marchant Date: Thu, 30 May 2019 11:32:50 -0400 Subject: [PATCH] Added "desktop" fullscreen back in, plus removed key repeats. --- src/defs.h | 2 +- src/game.c | 5 ++++- src/player.c | 10 ++++++---- src/title.c | 8 ++------ 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/defs.h b/src/defs.h index 0619ee2..22309d1 100644 --- a/src/defs.h +++ b/src/defs.h @@ -57,7 +57,7 @@ along with this program. If not, see . #define PATH_MAX 4096 #endif -#define FULLSCREEN SDL_WINDOW_FULLSCREEN +#define FULLSCREEN SDL_WINDOW_FULLSCREEN_DESKTOP #define DEFAULT_SCREEN_WIDTH MAX(SCREEN_WIDTH, 640) #define DEFAULT_SCREEN_HEIGHT MAX(SCREEN_HEIGHT, 480) diff --git a/src/game.c b/src/game.c index 13105dd..0f435d5 100644 --- a/src/game.c +++ b/src/game.c @@ -1551,7 +1551,10 @@ static void game_doPlayer() audio_playSound(SFX_EXPLOSION, player.x, player.y); } - engine.keyState[KEY_UP] = engine.keyState[KEY_DOWN] = engine.keyState[KEY_LEFT] = engine.keyState[KEY_RIGHT] = 0; + engine.keyState[KEY_UP] = 0; + engine.keyState[KEY_DOWN] = 0; + engine.keyState[KEY_LEFT] = 0; + engine.keyState[KEY_RIGHT] = 0; if (CHANCE(1. / 3.)) explosion_add(player.x + RANDRANGE(-10, 10), player.y + RANDRANGE(-10, 10), SP_BIG_EXPLOSION); diff --git a/src/player.c b/src/player.c index 0d7c00a..a4590a0 100644 --- a/src/player.c +++ b/src/player.c @@ -265,11 +265,13 @@ void player_getInput() break; case SDL_KEYDOWN: - engine.keyState[mapkey(engine.event.key.keysym.sym)] = 1; - - if (engine.gameSection != SECTION_GAME) - engine.paused = 0; + if (!engine.event.key.repeat) + { + engine.keyState[mapkey(engine.event.key.keysym.sym)] = 1; + if (engine.gameSection != SECTION_GAME) + engine.paused = 0; + } break; case SDL_KEYUP: diff --git a/src/title.c b/src/title.c index f97a9f7..eea5623 100644 --- a/src/title.c +++ b/src/title.c @@ -530,7 +530,6 @@ int title_show() if ((selectedOption == 1) && (engine.useAudio)) { engine.useSound = !engine.useSound; - selectedOption = listLength; } else if ((selectedOption == 2) && (engine.useAudio)) { @@ -545,19 +544,16 @@ int title_show() { audio_haltMusic(); } - selectedOption = listLength; } else if (selectedOption == 3) { engine.fullScreen = !engine.fullScreen; SDL_SetWindowFullscreen(window, (engine.fullScreen ? FULLSCREEN : 0)); - selectedOption = listLength; } else if (selectedOption == 4) { engine.autoPause = !engine.autoPause; - selectedOption = listLength; } else if (selectedOption == listLength) { @@ -699,9 +695,9 @@ void title_showCredits() break; float speed = 0.5; - if(engine.keyState[KEY_DOWN]) + if (engine.keyState[KEY_DOWN]) speed = 2; - else if(engine.keyState[KEY_UP]) + else if (engine.keyState[KEY_UP]) speed = -2; for (i = 0 ; i <= lastCredit ; i++)