Closed JDoucette closed 2 years ago
If you use the indexes in order, then the first 0,1,2,3 applies to Joystick 1, and 4,5,6,7 applies to Joystick 2.
40 SCREEN 0:WIDTH 80
50 X1=STICK(0):Y1=STICK(1)
60 X2=STICK(2):Y2=STICK(3)
70 J1ACHANGE=STRIG(0):J1ACURRENT=STRIG(1)
80 J1BCHANGE=STRIG(2):J1BCURRENT=STRIG(3)
90 J2ACHANGE=STRIG(4):J2ACURRENT=STRIG(5)
100 J2BCHANGE=STRIG(6):J2BCURRENT=STRIG(7)
110 PRINT USING "JOY1 X ### Y ### A ## ## B ## ## JOY2 X ### Y ### A ## ## B ## ##";X1;Y1;J1ACHANGE;J1ACURRENT;J1BCHANGE;J1BCURRENT;X2;Y2;J2ACHANGE;J2ACURRENT;J2BCHANGE;J2BCURRENT
120 GOTO 50
Fixed by commit 7ca38a81, thanks for reporting!
Bug report
Problem STRIG(x) returns the wrong buttons.
With Xbox 360 controller plugged into Windows 10 machine, and I run this program:
I see this option when pressing A and B buttons on joystick 1:
This corresponds to STRIG(x) for x = 0,1,2,3. But the documentation: https://robhagemans.github.io/pcbasic/doc/1.2/#STRIG-function Says that x = 0,1,4,5 are joystick 1. 2,3,6,7 are joystick 2.
Is the documentation wrong? Or is PC BASIC emulation wrong? Perhaps PC-BASIC could allow remapping of controller buttons, in case this is not clear, or in case Xbox controller does not follow standard button mappings for Windows (I seem to doubt that; it is probably standard).
Steps See program above. Run it. Press A and B on joystick one, and watch the output. Better yet: plug in joystick two, and see if that works as well (I have not tried).
Program See above.
Crash log None.
Notes
PC-BASIC version: 1.2.14 Operating system version: Windows 10