Code archives/User Input/USB 12 buttons joypad

This code has been declared by its author to be Public Domain code.

Download source code

USB 12 buttons joypad by Litobyte2002
To support Digital USB 12 buttons joypad compatbile with the MS one, or the Creative Cobra you can freely use this code.

The only not working value seems the Z(pad wheel).
All the 12 buttons are reconized.
Keep the direction thumb pressed for actual direction,
press it once for last pressed direction.

cheers
; JoyType() example 
; Modified for 10 buttons joypad (Microsoft, Creative compatible)

; Check to see what stick is present - print the proper message 
Select JoyType() 
Case 0 
	Print "Sorry, no joystick attached to system!" 
Case 1 
	Print "Digital joystick is attached to system!" 
Case 2 
	Print "Analog joystick is attched to system!" 
End Select
Print

; Wait for user to hit ESC 
If JoyType()<>0 Then
	button=0
	Print "press a joypad button(1-12) to start"
	Print "press 'select' button to quit" 
	WaitJoy()
	While Not(JoyHit(10) Or KeyHit(1))
		.label
		Cls
		Locate 0,40
		Print "Joystick button n°"+button
		Print "joyX: "+JoyX()
		Print "joyY: "+JoyY()
		Print "joyXDir: "+JoyXDir()
		Print "joyYDir: "+JoyYDir()
		Print "joyZ: not supported"+JoyZ()
		Print:Print:Print "press Select Button to quit"
		FlushJoy
		.lab2
		If (JoyXDir()<>0 Or JoyYDir()<>0) Goto label
		button=GetJoy()
		If button=0 Then Goto lab2
	Wend
Else
	While Not KeyHit(1) 
	Wend
EndIf

Comments

None.

Code Archives Forum