Skip to content
This repository has been archived by the owner on Mar 10, 2021. It is now read-only.

Make protected calls to isDown() functions. #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Input.lua
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,15 @@ function Input:down(action, interval, delay)
end

elseif action and not interval and not delay then
local status = false
local isDown = false
for _, key in ipairs(self.binds[action]) do
if (love.keyboard.isDown(key) or love.mouse.isDown(key_to_button[key] or 0)) then
return true
end

status, isDown = pcall(love.keyboard.isDown, key)
if status and isDown then return true end

status, isDown = pcall(love.mouse.isDown, key_to_button[key])
if status and isDown then return true end

-- Supports only 1 gamepad, add more later...
if self.joysticks[1] then
if axis_to_button[key] then
Expand Down