mirror of
https://github.com/love2d/love.git
synced 2026-08-17 11:00:31 +02:00
Fixed love.keyboard.setKeyRepeat, fixed issues with Body:getWhatever, and made the save directory settable.
This commit is contained in:
@@ -46,11 +46,10 @@ namespace sdl
|
||||
|
||||
void Keyboard::setKeyRepeat(int delay, int interval) const
|
||||
{
|
||||
if(delay == DEFAULT)
|
||||
delay = SDL_DEFAULT_REPEAT_DELAY;
|
||||
delay = (delay == DEFAULT) ? SDL_DEFAULT_REPEAT_DELAY : delay;
|
||||
interval = (interval == DEFAULT) ? SDL_DEFAULT_REPEAT_INTERVAL : interval;
|
||||
|
||||
if(interval == DEFAULT)
|
||||
interval = SDL_DEFAULT_REPEAT_INTERVAL;
|
||||
SDL_EnableKeyRepeat(delay, interval);
|
||||
}
|
||||
|
||||
int Keyboard::getKeyRepeatDelay() const
|
||||
|
||||
@@ -46,13 +46,14 @@ namespace sdl
|
||||
|
||||
int w_setKeyRepeat(lua_State * L)
|
||||
{
|
||||
if(lua_gettop(L) == 0)
|
||||
{
|
||||
instance->setKeyRepeat(0, 0);
|
||||
return 0;
|
||||
if(lua_gettop(L) == 0)
|
||||
{
|
||||
// Disables key repeat.
|
||||
instance->setKeyRepeat(0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
instance->setKeyRepeat(luaL_checkint(L, 1), luaL_checkint(L, 2));
|
||||
instance->setKeyRepeat(luaL_optint(L, 1, Keyboard::DEFAULT), luaL_optint(L, 2, Keyboard::DEFAULT));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user