Make isDown accept a list of keys (issue #121)

This commit is contained in:
Bart van Strien
2011-03-19 12:47:39 +01:00
parent 20364c67bd
commit 766c863484
3 changed files with 18 additions and 15 deletions
+6 -5
View File
@@ -31,14 +31,15 @@ namespace sdl
return "love.keyboard.sdl";
}
bool Keyboard::isDown(Key key) const
bool Keyboard::isDown(Key * keylist) const
{
SDLKey k;
if(keys.find(key, k))
Uint8 * keystate = SDL_GetKeyState(0);
for (Key key = *keylist; key != KEY_MAX_ENUM; key = *(++keylist))
{
Uint8 * keystate = SDL_GetKeyState(0);
return keystate[(unsigned)k] == 1;
if (keys.find(key, k) && keystate[(unsigned)k] == 1)
return true;
}
return false;