|
Post by alwichita on Oct 23, 2023 18:04:56 GMT -5
Hi guys ! Does anyone know of a way to read more than 2 joysticks? Thanks Al
|
|
|
Post by Rod on Oct 24, 2023 3:17:17 GMT -5
Yes perfectly possible with API but I will need to trawl through some old hard discs to find the code. We did have a tutorial but that too has been lost over time.
|
|
|
Post by metro on Oct 24, 2023 7:13:52 GMT -5
Unsure if any of this is useful... 'Bare bones joystick demo 'prints out x,y,z position 'and buttons pressed.
nomainwin
open "winmm.dll" for dll as #mm Struct JOYINFO, _ x As long , _ 'x position y As long , _ 'y position z As long , _ 'z position buttons As long 'buttons pushed
JOYSTICK1 = 0 JOYSTICK2 = 1
UpperLeftX=10:UpperLeftY=10 WindowWidth=600:WindowHeight=450 statictext #1.x, "X",10,10,100,24 statictext #1.y, "Y",10,40,100,24
statictext #1.z, "Z",10,70,100,24
statictext #1.1, "1",10,100,100,24 statictext #1.2, "2",10,130,100,24
Open "Joystick Demo" for window_nf as #1 print #1, "trapclose [quit]"
timer 150, [checkJoy]
[loop] wait
[quit] close #mm close #1 : END
[checkJoy] calldll #mm, "joyGetPos", _ JOYSTICK1 as long, _ JOYINFO as struct ,_ result as long
X = JOYINFO.x.struct Y = JOYINFO.y.struct Z = JOYINFO.z.struct
b1 = JOYINFO.buttons.struct and 1
b2 = JOYINFO.buttons.struct and 2 print #1.x, "X - ";X print #1.y, "Y - ";Y print #1.z, "Z - ";Z
if b1 then print #1.1, "Button 1 - down" else print #1.1, "Button 1 - up" end if
if b2 then print #1.2, "Button 2 - down" else print #1.2, "Button 2 - up" end if
goto [loop]
|
|
|
Post by Rod on Oct 24, 2023 9:22:20 GMT -5
Excellent. That was the tutorial, the html download. It contains the API demo to read as many joysticks as can be attached.
|
|
|
Post by alwichita on Oct 24, 2023 13:36:05 GMT -5
Great ! thanks guys ! I'll look into it... Thanks again !!!!
|
|