mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01: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:
parent
e23682615d
commit
8fa916c55d
1 changed files with 8 additions and 4 deletions
|
@ -77,17 +77,21 @@ void KeyPoll::Poll()
|
||||||
if (evt.type == SDL_KEYDOWN)
|
if (evt.type == SDL_KEYDOWN)
|
||||||
{
|
{
|
||||||
keymap[evt.key.keysym.sym] = true;
|
keymap[evt.key.keysym.sym] = true;
|
||||||
|
|
||||||
if (evt.key.keysym.sym == SDLK_BACKSPACE)
|
if (evt.key.keysym.sym == SDLK_BACKSPACE)
|
||||||
{
|
{
|
||||||
pressedbackspace = true;
|
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 */
|
#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
|
#else
|
||||||
(keymap[SDLK_LALT] || keymap[SDLK_RALT])
|
bool altpressed = keymap[SDLK_LALT] || keymap[SDLK_RALT];
|
||||||
#endif
|
#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;
|
toggleFullscreen = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue