britzl / defold-input

Simplify input related operations such as gesture detection, input mapping and clicking/dragging game objects
MIT License
111 stars 26 forks source link

All states in gestures.two_finger are false #6

Closed Jerakin closed 5 years ago

Jerakin commented 5 years ago

Simple repo gestures_issue.zip

local gesture                   = require "in.gesture"

function init(self)
    msg.post(".", "acquire_input_focus")
    gesture.SETTINGS.multi_touch = true
end

function on_input(self, action_id, action)
    local g = gesture.on_input(self, action_id, action)
    if g and action.released then
        pprint(g)
    end
end

Even though two fingers is swiped the output is this, same goes for any other action with two fingers.

 { --[[0xf1d29270]]
01-21 14:16:20.034  3933  3952 D defold  :   swipe_right = false,
01-21 14:16:20.034  3933  3952 D defold  :   swipe_up = false,
01-21 14:16:20.034  3933  3952 D defold  :   two_finger = { --[[0xf1d292a0]]
01-21 14:16:20.034  3933  3952 D defold  :     swipe_up = false,
01-21 14:16:20.034  3933  3952 D defold  :     tap = false,
01-21 14:16:20.034  3933  3952 D defold  :     swipe_right = false,
01-21 14:16:20.034  3933  3952 D defold  :     swipe_down = false,
01-21 14:16:20.034  3933  3952 D defold  :     long_press = false,
01-21 14:16:20.034  3933  3952 D defold  :     swipe_left = false,
01-21 14:16:20.034  3933  3952 D defold  :     double_tap = false
01-21 14:16:20.034  3933  3952 D defold  :   },
01-21 14:16:20.034  3933  3952 D defold  :   swipe_down = true,
01-21 14:16:20.034  3933  3952 D defold  :   swipe_left = false,
01-21 14:16:20.034  3933  3952 D defold  :   swipe = { --[[0xedf45320]]
01-21 14:16:20.034  3933  3952 D defold  :     from = vmath.vector3(218.33331298828, 935.02783203125, 0),
01-21 14:16:20.034  3933  3952 D defold  :     to = vmath.vector3(416.33331298828, 34.604248046875, 0),
01-21 14:16:20.034  3933  3952 D defold  :     time = 0.11771392822266
01-21 14:16:20.034  3933  3952 D defold  :   }
01-21 14:16:20.034  3933  3952 D defold  : }
Jerakin commented 5 years ago

Ooops. I forgot to setup the touch trigger.