bbJoyHat() - won't compile

Archives Forums/Blitz3D SDK Programming/bbJoyHat() - won't compile

John Pickford(Posted 2008) [#1]
Any ideas?


SteAbra(Posted 2008) [#2]
hmm? ... bbJoyHit() ... maybe!

Stephan


John Pickford(Posted 2008) [#3]
No I want bbjoyhat()

Function bbJoyHat(port=0) 
Description Returns a compass angle between 0 and 360 degrees in which the direction of the D-Pad or "hat" control is being pressed.
 
Information port number of joystick port to check (optional) 


bbJoyHat returns a value of -1 if the "hat" or D-Pad is currently centered. 

The optional port identifier provides access to a particular game controller, joystick or gamepad connected to the system and positively identified by bbJoyType. 

See Also: bbJoyX bbJoyY bbJoyZ bbJoyU bbJoyYaw bbJoyPitch bbJoyRoll 



Beaker(Posted 2008) [#4]
I did notice that one command was missing or commented out a long time ago. Pretty sure it was this one. It was quite easy to fix tho. Are you using Bmax?


John Pickford(Posted 2008) [#5]
Yes.


Beaker(Posted 2008) [#6]
Thinking back - I didn't fix it, cos it just didn't exist, I had to remove it from my Python wrapper:
http://blitzmax.com/Community/posts.php?topic=70692


John Pickford(Posted 2008) [#7]
So there's no way for me to read the d-pad?


Mark Tiffany(Posted 2008) [#8]
Is this the same issue:

http://www.blitzmax.com/Community/posts.php?topic=77732

If so, looks like it's due to the 360 pad and dx7 not being 100% compatible?


marksibly(Posted 2008) [#9]
Hi,

I don't have a joypad right now, but this compiles/links for me:

Strict
Import blitz3d.blitz3dsdk
bbBeginBlitz3D
Print bbJoyHat(0)
bbEndBlitz3D


But, there appears to be a problem in commands.bmx: bbJoyHat should return a float but the max version is only returning an int. You'll need to change the function decl in commands.bmx to:

Function bbJoyHat#(port=0)="bbJoyHat"

I'm having a big tidy up next week of lots of stuff, so you can wait until then...


John Pickford(Posted 2008) [#10]
Okay, no worries. I've postponed that 'feature' for now.


marksibly(Posted 2008) [#11]
Sorry...that was a little rude...I meant to say '*if* you can wait..'.

But still, my example above compiles fine - have you tried it? Anyone else?


Floyd(Posted 2008) [#12]
It won't compile here: "undefined reference to joyhat()". But thats with an old version of the SDK. Maybe this got fixed.

I did wonder whether bbJoyHat() should be a float, like other commands such as bbJoyX(). But JoyHat() is an integer in Blitz3D.

It probably makes little difference as the integer value is accurate enough. For example, JoyX() is a float and so can potentially take millions of possible values. But experimentation shows that my joystick will only generate about sixty distinct values for JoyX(). And considering the tiny range of physical movement that's plenty.


Warner(Posted 2008) [#13]
I also get the message undefined reference to `bbJoyHat', and I updated from svn one or two weeks ago.