diff --git a/baton.lua b/baton.lua index 75c5f4b..d672fe7 100644 --- a/baton.lua +++ b/baton.lua @@ -191,6 +191,12 @@ end keyboard or joystick inputs. ]] function Player:_setActiveDevice() + -- if the joystick is unset, then we should make sure _activeDevice + -- isn't "joy" anymore, otherwise there will be an error later + -- when we try to query a joystick that isn't there + if self._activeDevice == 'joy' and not self.config.joystick then + self._activeDevice = 'none' + end for _, control in pairs(self._controls) do for _, source in ipairs(control.sources) do local type, value = parseSource(source) diff --git a/main.lua b/main.lua index 1fc1297..1674fff 100644 --- a/main.lua +++ b/main.lua @@ -55,6 +55,9 @@ function love.update(dt) end function love.keypressed(key) + if key == 'space' then + player.config.joystick = nil + end if key == 'escape' then love.event.quit() end