Joysticks

BlitzPlus Forums/BlitzPlus Programming/Joysticks

Cancerboy(Posted 2006) [#1]
Is there a way to get the name of the joystick attached? In commercial games they grab the name of the stick (XBox 360 USB for example). I thought this would be helpful for people with multiple sticks attached to the same machine. I know joytype reports digital or analog but I was hoping for something a little more specific. Any help would greatly be appreciated.


Matty(Posted 2006) [#2]
Not with any of the standard blitz commands.


Cancerboy(Posted 2006) [#3]
Are there any free dlls that do the trick?


GfK(Posted 2006) [#4]
Try this.


Cancerboy(Posted 2006) [#5]
That works! THANKS!

From within B+ I add the dll and .decls into the userlibs directory. To include it with my game would I just drop it in the same directory as my executable?


Cancerboy(Posted 2006) [#6]
Nevermind... seems to include the files inside the exe. Even nicer!


tjompen(Posted 2007) [#7]
Hi! joystick newbie here....I can't get this to work...using XP and blitz+ 1.44.
"Error in userlib "winmm.decls" -expecting '(' after function identifier"

winmm.decls
===============
.lib "winmm.dll"
winmm_joyGetDevCaps%(id%,lpCaps*,uSize%):"joyGetDevCapsA"

;
; Joystick Property constants
; Do not change!
;
Const joy_Mid = 0
Const joy_Pid = 2
Const joy_Name = 4
Const joy_Xmin = 36
Const joy_Xmax = 40
Const joy_Ymin = 44
Const joy_Ymax = 48
Const joy_Zmin = 52
Const joy_Zmax = 56
Const joy_NumButtons = 60
Const joy_PeriodMin = 64
Const joy_PeriodMax = 68
Const joy_Rmin = 72
Const joy_Rmax = 76
Const joy_Umin = 80
Const joy_Umax = 84
Const joy_Vmin = 88
Const joy_Vmax = 92
Const joy_Caps = 96
Const joy_MaxAxes = 100
Const joy_NumAxes = 104
Const joy_MaxButtons = 108
Const joy_RegKey = 112
Const joy_OEMVxD = 144

code:
==============
Include "winmm.decls"

Graphics 400,400,0,2

joyport = 0
Print "Joystick "+joyport+" Properties:"
Print " Mid - "+GetJoyProperty(joyport,joy_Mid)
Print " Pid - "+GetJoyProperty(joyport,joy_Pid)
Print " Name - "+GetJoyProperty(joyport,joy_Name)
Print " Xmin - "+GetJoyProperty(joyport,joy_Xmin)
Print " Xmax - "+GetJoyProperty(joyport,joy_Xmax)
Print " Ymin - "+GetJoyProperty(joyport,joy_Ymin)
Print " Ymax - "+GetJoyProperty(joyport,joy_Ymax)
Print " Zmin - "+GetJoyProperty(joyport,joy_Zmin)
Print " Zmax - "+GetJoyProperty(joyport,joy_Zmax)
Print " NumButtons - "+GetJoyProperty(joyport,joy_NumButtons)
Print " PeriodMin - "+GetJoyProperty(joyport,joy_PeriodMin)
Print " PeriodMax - "+GetJoyProperty(joyport,joy_PeriodMax)
Print " Rmin - "+GetJoyProperty(joyport,joy_Rmin)
Print " Rmax - "+GetJoyProperty(joyport,joy_Rmax)
Print " Umin - "+GetJoyProperty(joyport,joy_Umin)
Print " Umax - "+GetJoyProperty(joyport,joy_Umax)
Print " Vmin - "+GetJoyProperty(joyport,joy_Vmin)
Print " Vmax - "+GetJoyProperty(joyport,joy_Vmax)
Print " Caps - "+GetJoyProperty(joyport,joy_Caps)
Print " MaxAxes - "+GetJoyProperty(joyport,joy_MaxAxes)
Print " NumAxes - "+GetJoyProperty(joyport,joy_NumAxes)
Print " MaxButtons - "+GetJoyProperty(joyport,joy_MaxButtons)
Print " RegKey - "+GetJoyProperty(joyport,joy_RegKey)
Print " OEMVxD - "+GetJoyProperty(joyport,joy_OEMVxD)
Print
Print "Press any key to quit!"
WaitKey()
End


tjompen(Posted 2007) [#8]
HELP!