Page 1 of 1

Better joystick functions

Posted: Sat Nov 17, 2007 3:26 pm
by djes
Hi to the great PB team!

I'd like to have better joystick functions. Actually I'm using joyGetPosEx_ and it's OK for me, except I need a window to do that, so I have to do a trick that scares me a bit. So I'd like to have native functions in purebasic.

Thank you!

Code I'm using :

Code: Select all

joy_an=joyGetNumDevs_()
joyCaps.JOYCAPS

For u=0 To joy_an
  joyGetDevCaps_(u,joyCaps,SizeOf(JOYCAPS))
  Debug "Joystick "+Str(u)
  Debug joyCaps\szPname
Next u

If joySetCapture_(WindowID(1),#JOYSTICKID1,#Null,#False) = #JOYERR_NOERROR
  If joyGetDevCaps_(#JOYSTICKID1,joyCaps,SizeOf(JOYCAPS)) = #JOYERR_NOERROR
    JoyXamp.l=joyCaps\wXmax-joyCaps\wXmin ;amplitude du mouvement du joystick en X
    JoyYamp.l=joyCaps\wYmax-joyCaps\wYmin
    ; done
  Else
    Debug "Joystick error"
  EndIf
EndIf

joyInfoEx.JOYINFOEX
joyInfoEx\dwFlags = #JOY_RETURNALL
joyInfoEx\dwSize = SizeOf(JOYINFOEX)

;---
joyGetPosEx_(#JOYSTICKID1,joyInfoEx.JOYINFOEX)

;---
if (joyInfoEx\dwButtons&1) And joystick_switch
   blah bla
endif

Posted: Wed Nov 21, 2007 5:12 pm
by djes
Well, I'm a bit stupid, I forgot to say what could be added, in fullscreen and windowed if possible...

1) Real positions values, not just "right" or "left" or "top" or "bottom". On PC, potentiometric (analogic) joysticks are there for a very long time (I had one in 1985!), so it's a bit strange to not be able to use them.

2) To be able to select a different joystick and know infos about it

3) To test all buttons in an easy way :)

No hurry for this, as I said, it's just to improve the language :=)
I do prefer you focus on vista directx speed ;)

Posted: Wed Nov 21, 2007 6:46 pm
by Flaming Amoeba
In general, doesn't MS recommend not using DirectInput when in windowed mode?

DirectInput is dead and no longer supported and is not supposed to be used under Vista. Under Vista you are supposed to use wminput or xinput.

I am sure the team will update the input side once they get DX9 up and running. Unlike other languages (Blitz), the PB Team does believe in keeping the product up to date with and compatible with current technology.

Posted: Wed Nov 21, 2007 7:56 pm
by djes
Surely :)

Posted: Thu Jun 19, 2008 11:17 pm
by Joakim Christiansen
Would be neat