Haptic feedback depending on whether a given key is currently depressed
Doeke Buursma 10
I've got a nice little custom remote that uses touch to provide a region which behaves as an arrowpad (when you touch near the top of the region, the "up arrow" key is depressed etc.). I'd like the device to provide haptic feedback when the current state of depressed keys changes (i.e., when I move my finger from the top of the region to the bottom, the current state changes from "up-depressed" to "down-depressed" so haptic feedback should be provided). To do this, I need a way to recognized which keys are currently depressed. However, I don't see such a thing in the keyboard documentation. Does anyone know of a way to accomplish this goal? Perhaps with a workaround?
Here's a minimal example of what I want to do:
kb = libs.keyboard dev = libs.device actions.arrow = function(id, x, y) if y > 100 then if [up arrow key is currently depressed] then dev.vibrate() end kb.up("up") kb.down("down") elseif y < 100 then if [down arrow key is currently depressed] then dev.vibrate() end kb.up("down") kb.down("up") end end
I look forward to your thoughts!