mirror of
https://github.com/TangentFoxy/baton.git
synced 2025-07-27 18:42:19 +00:00
fix error when unsetting the joystick while _activeDevice is 'joy'
This commit is contained in:
@@ -191,6 +191,12 @@ end
|
|||||||
keyboard or joystick inputs.
|
keyboard or joystick inputs.
|
||||||
]]
|
]]
|
||||||
function Player:_setActiveDevice()
|
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 _, control in pairs(self._controls) do
|
||||||
for _, source in ipairs(control.sources) do
|
for _, source in ipairs(control.sources) do
|
||||||
local type, value = parseSource(source)
|
local type, value = parseSource(source)
|
||||||
|
Reference in New Issue
Block a user