Better joystick functions

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Better joystick functions

Post 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
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post 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 ;)
Flaming Amoeba

Post 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.
User avatar
djes
Addict
Addict
Posts: 1806
Joined: Sat Feb 19, 2005 2:46 pm
Location: Pas-de-Calais, France

Post by djes »

Surely :)
User avatar
Joakim Christiansen
Addict
Addict
Posts: 2452
Joined: Wed Dec 22, 2004 4:12 pm
Location: Norway
Contact:

Post by Joakim Christiansen »

Would be neat
I like logic, hence I dislike humans but love computers.
Post Reply