Joy gethat

From Bennu Wiki
Revision as of 13:06, 17 October 2009 by Sandman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


INT joy_gethat ( [ <INT JoyID> ] , <INT hat> )


Returns the current position of the digital POV hat of the controller pad selected.

The return values are:

Constant - Value - Description
JOY_HAT_CENTERED - 0 - The hat is centered.
JOY_HAT_UP - 1 - The hat is moved up.
JOY_HAT_RIGHT - 2 - The hat is moved right.
JOY_HAT_DOWN - 4 - The hat is moved down.
JOY_HAT_LEFT - 8 - The hat is moved left.
JOY_HAT_RIGHTUP - 3 - The hat is moved right and up.
JOY_HAT_RIGHTDOWN - 6 - The hat is moved right and down.
JOY_HAT_LEFTUP - 9 - The hat is moved left and up.
JOY_HAT_LEFTDOWN - 12 - The hat is moved left and down.

You may notice that some are combinations of others. For example JOY_HAT_RIGHTUP == (JOY_HAT_RIGHT | JOY_HAT_UP ). This is because the returned value has bit flags indicating four directions: up, down, left, right. These can be combined to make diagonal directions.

A value of -1 is returned when there is no hat or joystick detected.

The JoyID is optional, if it is not present, the function uses the selected joystick. You can change the selected joystick with joy_select().


[INT JoyID] - The JoyID of the joystick.
INT hat - The number of the hat, starting at 0


INT : The position of the POV hat.


Functions Getjoyposition()Joyaxes()Joybuttons()Joygetaxis()Joygetball()Joygetbutton()Joygethat()Joyname()Joynumaxes()Joynumballs()Joynumber()Joynumbuttons()Joynumhats()Joynumjoysticks()Joyselect()