Minor code cleanup

This commit is contained in:
Alex Szpakowski
2014-05-01 14:12:21 -03:00
parent e667485f68
commit e4dc533bb2
26 changed files with 112 additions and 110 deletions
+2 -3
View File
@@ -51,12 +51,11 @@ bool Keyboard::hasKeyRepeat() const
bool Keyboard::isDown(Key *keylist) const
{
const Uint8 *keystate = SDL_GetKeyboardState(0);
std::map<Key, SDL_Keycode>::const_iterator it;
const Uint8 *keystate = SDL_GetKeyboardState(nullptr);
for (Key key = *keylist; key != KEY_MAX_ENUM; key = *(++keylist))
{
it = keys.find(key);
auto it = keys.find(key);
if (it != keys.end() && keystate[SDL_GetScancodeFromKey(it->second)])
return true;
}
+2
View File
@@ -56,6 +56,8 @@ public:
private:
// Whether holding down a key triggers repeated key press events.
// The real implementation is in love::event::sdl::Event::Convert.
bool key_repeat;
static std::map<Key, SDL_Keycode> createKeyMap();
+2 -2
View File
@@ -29,7 +29,7 @@ namespace love
namespace keyboard
{
static Keyboard *instance = 0;
static Keyboard *instance = nullptr;
int w_setKeyRepeat(lua_State *L)
{
@@ -87,7 +87,7 @@ static const luaL_Reg functions[] =
extern "C" int luaopen_love_keyboard(lua_State *L)
{
if (instance == 0)
if (instance == nullptr)
{
EXCEPT_GUARD(instance = new love::keyboard::sdl::Keyboard();)
}