Joy gethat

From Bennu Wiki
Jump to: navigation, search


Syntax

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

Description

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().

Parameters

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

Returns

INT : The position of the POV hat.

Example

Mod_joy
Constants None
Imported:
JOYHATCENTEREDJOYHATDOWNJOYHATLEFTJOYHATLEFTDOWNJOYHATLEFTUPJOYHATRIGHTJOYHATRIGHTDOWNJOYHATRIGHTUPJOYHATUP
Functions Getjoyposition()Joyaxes()Joybuttons()Joygetaxis()Joygetball()Joygetbutton()Joygethat()Joyname()Joynumaxes()Joynumballs()Joynumber()Joynumbuttons()Joynumhats()Joynumjoysticks()Joyselect()