@a1ex
Hope you can quickly help and put me out of my misery.
'All' I'm trying to do is use event.keypress to look out only (sic) for a half shutter press and not a full shutter press.
My question is, when you do a full shutter press, does the key event handler go through the full sequence, ie halfshuuter, fullshuuter, fullshutterunpress, halfshutterunpress, or some other logic.
Thus if I look for and halfshutterunpress and a key.last == fullshutterunpress I should be ok. But when I try this, it doesn't seem to work.
Cheers
Garry
@a1ex
Worked it out, but don't understand the problem.
It seems key.last doesn't work inside event.keypress.
Thus, if I use this code, it doesn't work:
if (kk == KEY.UNPRESS_HALFSHUTTER) and key.last ~= 4 then -- reset and change direction of ML state changes
direction = -direction
return true
end
But if I use this code and explicitly track the last key, ie the last variable, myself, then all is well:
if (kk == KEY.UNPRESS_HALFSHUTTER) and last ~= 4 then -- reset and change direction of ML state changes
direction = -direction
return true
end
Even simpler :-)
if (kk == KEY.UNPRESS_HALFSHUTTER) and last_key == KEY.HALFSHUTTER then -- reset and change direction of ML state changes
direction = -direction
last_key = kk
return true
end
Thinking about it, I guess key.last hasn't been set until the key event completes. So I'll just explicitly track myself :-)