love.graphics object creation functions (love.graphics.new*) now cause an error instead of hard-crashing, if called when the window has not been created yet.

This commit is contained in:
Alex Szpakowski
2016-02-11 22:34:33 -04:00
parent ab4cfb4a35
commit 7c4edf2efc
4 changed files with 41 additions and 10 deletions
+3 -4
View File
@@ -55,6 +55,7 @@ bool Keyboard::isDown(const std::vector<Key> &keylist) const
for (Key key : keylist)
{
SDL_Scancode scancode = SDL_GetScancodeFromKey(keymap[key]);
if (state[scancode])
return true;
}
@@ -68,11 +69,9 @@ bool Keyboard::isScancodeDown(const std::vector<Scancode> &scancodelist) const
for (Scancode scancode : scancodelist)
{
SDL_Scancode sdlscancode = SDL_SCANCODE_UNKNOWN;
if (!scancodes.find(scancode, sdlscancode))
continue;
SDL_Scancode sdlcode = SDL_SCANCODE_UNKNOWN;
if (state[sdlscancode])
if (scancodes.find(scancode, sdlcode) && state[sdlcode])
return true;
}