GLFW Xbox Controller joypad triggers

Monkey Forums/Monkey Bug Reports/GLFW Xbox Controller joypad triggers

Raz(Posted 2013) [#1]
As far as I can tell, it is not possible to check for the left trigger and right trigger being pressed at the same time on an Xbox 360 controller. JoyZ(0,0) returns a combination of the left trigger and right trigger (with a fully pressed right trigger returning negative -1), where as JoyZ(1,0) does not function.

Test code below (same results for Monkey 66 and 70e)

Thanks
-Chris

Import mojo

Class TestApp Extends App

	Method OnCreate()
		SetUpdateRate(60)
	End
	
	Method OnUpdate()
	
	End
	
	Method OnRender()
		Cls
		
		DrawText("Press A to poll joypad, then try LT and RT",100,100)
		DrawText("LT : "+JoyZ(0,0),100,130)
		DrawText("RT : "+JoyZ(1,0),100,150)
	End

End

Function Main()
	New TestApp
End



SLotman(Posted 2013) [#2]
I think that's the default behaviour - It's been a long time since I've implemented it on Blitz3D, but if memory serves me well, it should return 0 if you have both pressed at the same time.

Confirmed: Just ran my old test program, and it reports -255 for right, 255 for left... and 0 for both (same value if none is pressed). So this is how it should be when you check JoyZ.

You must check each trigger individually (left trigger/right trigger, not Z) to see if they're pressed.

I don't know how it's implemented on Monkey, but this is what I did on Blitz3D:




Samah(Posted 2013) [#3]
This phenomenon is a limitation of the default drivers. I believe you should be able to bypass this restriction if you use xinput, but that will require a lot of mojo hacking.