1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="Start" href="index.html">
<link rel="previous" href="Sdltimer.html">
<link rel="next" href="Sdlkey.html">
<link rel="Up" href="index.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Sdl" rel="Chapter" href="Sdl.html">
<link title="Sdlcdrom" rel="Chapter" href="Sdlcdrom.html">
<link title="Sdltimer" rel="Chapter" href="Sdltimer.html">
<link title="Sdljoystick" rel="Chapter" href="Sdljoystick.html">
<link title="Sdlkey" rel="Chapter" href="Sdlkey.html">
<link title="Sdlmouse" rel="Chapter" href="Sdlmouse.html">
<link title="Sdlevent" rel="Chapter" href="Sdlevent.html">
<link title="Sdlvideo" rel="Chapter" href="Sdlvideo.html">
<link title="Sdlwm" rel="Chapter" href="Sdlwm.html">
<link title="Sdlgl" rel="Chapter" href="Sdlgl.html">
<link title="Sdlttf" rel="Chapter" href="Sdlttf.html">
<link title="Sdlloader" rel="Chapter" href="Sdlloader.html">
<link title="Sdlmixer" rel="Chapter" href="Sdlmixer.html"><link title="Joystick state " rel="Section" href="#3_Joystickstate">
<title>OCamlSDL 0.7.2 : Sdljoystick</title>
</head>
<body>
<div class="navbar"><a href="Sdltimer.html">Previous</a>
<a href="index.html">Up</a>
<a href="Sdlkey.html">Next</a>
</div>
<center><h1>Module <a href="type_Sdljoystick.html">Sdljoystick</a></h1></center>
<br>
<pre><span class="keyword">module</span> Sdljoystick: <code class="code">sig</code> <a href="Sdljoystick.html">..</a> <code class="code">end</code></pre>Module for SDL joystick event handling<br>
<hr width="100%">
<br>
In order to use these functions, <a href="Sdl.html#VALinit"><code class="code">Sdl.init</code></a> must have been called
with the `JOYSTICK flag. This causes SDL to scan the system
for joysticks, and load appropriate drivers.<br>
<pre><span class="keyword">exception</span> <a name="EXCEPTIONSDLjoystick_exception"></a>SDLjoystick_exception <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info">
exception for error reporting<br>
</div>
<pre><span class="keyword">type</span> <a name="TYPEt"></a><code class="type"></code>t </pre>
<div class="info">
The joystick abstract type used to identify an SDL joystick<br>
</div>
<pre><span class="keyword">val</span> <a name="VALnum_joysticks"></a>num_joysticks : <code class="type">unit -> int</code></pre><div class="info">
Count the number of joysticks attached to the system<br>
</div>
<pre><span class="keyword">val</span> <a name="VALname"></a>name : <code class="type">int -> string</code></pre><div class="info">
Get the implementation dependent name of a joystick.
This can be called before any joysticks are opened.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALopen_joystick"></a>open_joystick : <code class="type">int -> <a href="Sdljoystick.html#TYPEt">t</a></code></pre><div class="info">
Open a joystick for use - the index passed as an argument refers to
the N'th joystick on the system. This index is the value which will
identify this joystick in future joystick events.<br>
<b>Raises</b> <code>SDLjoystick_exception</code> if an error occurred<br>
</div>
<pre><span class="keyword">val</span> <a name="VALopened"></a>opened : <code class="type">int -> bool</code></pre><div class="info">
<b>Returns</b> <code class="code">true</code> if joystick has been opened<br>
</div>
<pre><span class="keyword">val</span> <a name="VALindex"></a>index : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> int</code></pre><div class="info">
Get the device index of an opened joystick<br>
</div>
<pre><span class="keyword">val</span> <a name="VALnum_axes"></a>num_axes : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> int</code></pre><div class="info">
Get the number of general axis controls on a joystick<br>
</div>
<pre><span class="keyword">val</span> <a name="VALnum_balls"></a>num_balls : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> int</code></pre><div class="info">
Get the number of trackballs on a joystick
Joystick trackballs have only relative motion events associated
with them and their state cannot be polled.<br>
</div>
<pre><span class="keyword">val</span> <a name="VALnum_hats"></a>num_hats : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> int</code></pre><div class="info">
Get the number of POV hats on a joystick<br>
</div>
<pre><span class="keyword">val</span> <a name="VALnum_buttons"></a>num_buttons : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> int</code></pre><div class="info">
Get the number of buttons on a joystick<br>
</div>
<br>
<a name="3_Joystickstate"></a>
<h3>Joystick state </h3><br>
<pre><span class="keyword">val</span> <a name="VALupdate"></a>update : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> unit</code></pre><div class="info">
Update the current state of the open joysticks.
This is called automatically by the event loop if any joystick
events are enabled.<br>
</div>
<br>
Enable/disable joystick event polling.
If joystick events are disabled, you must call <a href="Sdljoystick.html#VALupdate"><code class="code">Sdljoystick.update</code></a>
yourself and check the state of the joystick when you want joystick
information.<br>
<pre><span class="keyword">val</span> <a name="VALset_event_state"></a>set_event_state : <code class="type">bool -> unit</code></pre><pre><span class="keyword">val</span> <a name="VALget_event_state"></a>get_event_state : <code class="type">unit -> bool</code></pre><pre><span class="keyword">type</span> <a name="TYPEhat_value"></a><code class="type"></code>hat_value = <code class="type">int</code> </pre>
<pre><span class="keyword">val</span> <a name="VALhat_centered"></a>hat_centered : <code class="type"><a href="Sdljoystick.html#TYPEhat_value">hat_value</a></code></pre><pre><span class="keyword">val</span> <a name="VALhat_up"></a>hat_up : <code class="type"><a href="Sdljoystick.html#TYPEhat_value">hat_value</a></code></pre><pre><span class="keyword">val</span> <a name="VALhat_right"></a>hat_right : <code class="type"><a href="Sdljoystick.html#TYPEhat_value">hat_value</a></code></pre><pre><span class="keyword">val</span> <a name="VALhat_down"></a>hat_down : <code class="type"><a href="Sdljoystick.html#TYPEhat_value">hat_value</a></code></pre><pre><span class="keyword">val</span> <a name="VALhat_left"></a>hat_left : <code class="type"><a href="Sdljoystick.html#TYPEhat_value">hat_value</a></code></pre><pre><span class="keyword">val</span> <a name="VALhat_rightup"></a>hat_rightup : <code class="type"><a href="Sdljoystick.html#TYPEhat_value">hat_value</a></code></pre><pre><span class="keyword">val</span> <a name="VALhat_rightdown"></a>hat_rightdown : <code class="type"><a href="Sdljoystick.html#TYPEhat_value">hat_value</a></code></pre><pre><span class="keyword">val</span> <a name="VALhat_leftup"></a>hat_leftup : <code class="type"><a href="Sdljoystick.html#TYPEhat_value">hat_value</a></code></pre><pre><span class="keyword">val</span> <a name="VALhat_leftdown"></a>hat_leftdown : <code class="type"><a href="Sdljoystick.html#TYPEhat_value">hat_value</a></code></pre><pre><span class="keyword">val</span> <a name="VALget_axis"></a>get_axis : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> int -> int</code></pre><pre><span class="keyword">val</span> <a name="VALget_hat"></a>get_hat : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> int -> <a href="Sdljoystick.html#TYPEhat_value">hat_value</a></code></pre><pre><span class="keyword">val</span> <a name="VALget_ball"></a>get_ball : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> int -> int * int</code></pre><pre><span class="keyword">val</span> <a name="VALget_button"></a>get_button : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> int -> bool</code></pre><pre><span class="keyword">val</span> <a name="VALclose"></a>close : <code class="type"><a href="Sdljoystick.html#TYPEt">t</a> -> unit</code></pre><div class="info">
Close a joystick previously opened with <a href="Sdljoystick.html#VALopen_joystick"><code class="code">Sdljoystick.open_joystick</code></a><br>
</div>
</body></html>
|