https://wiki.bennugd.org/index.php?title=Joy_gethat&feed=atom&action=historyJoy gethat - Revision history2024-03-28T18:57:57ZRevision history for this page on the wikiMediaWiki 1.36.2https://wiki.bennugd.org/index.php?title=Joy_gethat&diff=7593&oldid=prevSandman at 21:06, 17 October 20092009-10-17T21:06:20Z<p></p>
<p><b>New page</b></p><div>[[Category:functions]]<br />
[[Category:Joystick]]<br />
[[Category:Mod_joy]]<br />
<br />
== Syntax ==<br />
'''INT''' joy_gethat ( [ <'''INT''' JoyID> ] , <'''INT''' hat> )<br />
<br />
== Description ==<br />
Returns the current position of the digital POV hat of the controller pad selected.<br />
<br />
The return values are:<br />
{|<br />
| ''Constant'' || - ''Value'' || - ''Description''<br />
|-<br />
| JOY_HAT_CENTERED || - 0 || - The hat is centered.<br />
|-<br />
| JOY_HAT_UP || - 1 || - The hat is moved up.<br />
|-<br />
| JOY_HAT_RIGHT || - 2 || - The hat is moved right.<br />
|-<br />
| JOY_HAT_DOWN || - 4 || - The hat is moved down.<br />
|-<br />
| JOY_HAT_LEFT || - 8 || - The hat is moved left.<br />
|-<br />
| JOY_HAT_RIGHTUP || - 3 || - The hat is moved right and up.<br />
|-<br />
| JOY_HAT_RIGHTDOWN || - 6 || - The hat is moved right and down.<br />
|-<br />
| JOY_HAT_LEFTUP || - 9 || - The hat is moved left and up.<br />
|-<br />
| JOY_HAT_LEFTDOWN || - 12 || - The hat is moved left and down.<br />
|}<br />
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 flag]]s indicating four directions: up, down, left, right. These can be combined to make diagonal directions.<br />
<br />
A value of -1 is returned when there is no hat or [[joystick]] detected.<br />
<br />
The JoyID is optional, if it is not present, the function uses the selected joystick. You can change the selected joystick with [[joy_select]]().<br />
<br />
== Parameters ==<br />
{|<br />
| ['''INT''' JoyID] || - The [[JoyID]] of the [[joystick]].<br />
|-<br />
| '''INT''' hat || - The number of the hat, starting at <code>0</code><br />
|}<br />
<br />
== Returns ==<br />
'''INT''' : The position of the POV hat.<br />
<br />
== Example ==<br />
<br />
{{Moduledocbox<br />
| module = Mod_joy<br />
}}</div>Sandman