1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-25 22:18:30 +02:00

Make the toggle fullscreen conditional more readable

Each check has been put in its own variable, so the final conditional is
more readable, and the ifdef is no longer right smack in the middle of
an if-statement.

Also the control flow has been changed (the "else" has been removed from
the shortcut-checking conditional) so I could put the variables closer
to the actual conditional itself. I don't think it affects anything,
though.
This commit is contained in:
Misa 2020-03-12 16:29:03 -07:00 committed by Ethan Lee
parent e23682615d
commit 8fa916c55d

View File

@ -77,17 +77,21 @@ void KeyPoll::Poll()
if (evt.type == SDL_KEYDOWN)
{
keymap[evt.key.keysym.sym] = true;
if (evt.key.keysym.sym == SDLK_BACKSPACE)
{
pressedbackspace = true;
}
else if (((evt.key.keysym.sym == SDLK_RETURN || evt.key.keysym.sym == SDLK_f) &&
#ifdef __APPLE__ /* OSX prefers the command keys over the alt keys. -flibit */
(keymap[SDLK_LGUI] || keymap[SDLK_RGUI])
bool altpressed = keymap[SDLK_LGUI] || keymap[SDLK_RGUI];
#else
(keymap[SDLK_LALT] || keymap[SDLK_RALT])
bool altpressed = keymap[SDLK_LALT] || keymap[SDLK_RALT];
#endif
) || evt.key.keysym.sym == SDLK_F11)
bool returnpressed = evt.key.keysym.sym == SDLK_RETURN;
bool fpressed = evt.key.keysym.sym == SDLK_f;
bool f11pressed = evt.key.keysym.sym == SDLK_F11;
if ((altpressed && (returnpressed || fpressed)) || f11pressed)
{
toggleFullscreen = true;
}