Added "desktop" fullscreen back in, plus removed key repeats.

This commit is contained in:
Julie Marchant 2019-05-30 11:32:50 -04:00
parent b1df68f3de
commit 04033b332e
4 changed files with 13 additions and 12 deletions

View File

@ -57,7 +57,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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)

View File

@ -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);

View File

@ -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:

View File

@ -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++)