Xbox controller triggers
There is a new event in 1.9.2 that complements the existing onJoypadStickMove, onJoypadButtonDown/Up.
It is called onJoypadButtonPressureChange ( nJoypad, nButton, nPressure ) and works like this:
--------------------------------------------------------------------------------
function TEST_GamePad.onJoypadButtonPressureChange ( nJoypad, nButton, nPressure )
--------------------------------------------------------------------------------
if input.getJoypadType ( this.getUser ( ), 0 ) == input.kJoypadTypeXbox360 then
--nPressure is normalized between 0 and 1 for each trigger
if ( nButton == input.kJoypadButtonXbox360LTrigger ) then --do something
elseif ( nButton == input.kJoypadButtonXbox360RTrigger ) then --do something else
end
end
--------------------------------------------------------------------------------
end
--------------------------------------------------------------------------------