add OMAP layer handling
[sdl_omap.git] / docs / html / joystick.html
CommitLineData
e14743d1 1<HTML
2><HEAD
3><TITLE
4>Joystick</TITLE
5><META
6NAME="GENERATOR"
7CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
8"><LINK
9REL="HOME"
10TITLE="SDL Library Documentation"
11HREF="index.html"><LINK
12REL="UP"
13TITLE="SDL Reference"
14HREF="reference.html"><LINK
15REL="PREVIOUS"
16TITLE="SDL_JoystickEventState"
17HREF="sdljoystickeventstate.html"><LINK
18REL="NEXT"
19TITLE="SDL_NumJoysticks"
20HREF="sdlnumjoysticks.html"><META
21NAME="KEYWORD"
22CONTENT="joystick"><META
23NAME="KEYWORD"
24CONTENT="function"></HEAD
25><BODY
26CLASS="CHAPTER"
27BGCOLOR="#FFF8DC"
28TEXT="#000000"
29LINK="#0000ee"
30VLINK="#551a8b"
31ALINK="#ff0000"
32><DIV
33CLASS="NAVHEADER"
34><TABLE
35SUMMARY="Header navigation table"
36WIDTH="100%"
37BORDER="0"
38CELLPADDING="0"
39CELLSPACING="0"
40><TR
41><TH
42COLSPAN="3"
43ALIGN="center"
44>SDL Library Documentation</TH
45></TR
46><TR
47><TD
48WIDTH="10%"
49ALIGN="left"
50VALIGN="bottom"
51><A
52HREF="sdljoystickeventstate.html"
53ACCESSKEY="P"
54>Prev</A
55></TD
56><TD
57WIDTH="80%"
58ALIGN="center"
59VALIGN="bottom"
60></TD
61><TD
62WIDTH="10%"
63ALIGN="right"
64VALIGN="bottom"
65><A
66HREF="sdlnumjoysticks.html"
67ACCESSKEY="N"
68>Next</A
69></TD
70></TR
71></TABLE
72><HR
73ALIGN="LEFT"
74WIDTH="100%"></DIV
75><DIV
76CLASS="CHAPTER"
77><H1
78><A
79NAME="JOYSTICK"
80></A
81>Chapter 9. Joystick</H1
82><DIV
83CLASS="TOC"
84><DL
85><DT
86><B
87>Table of Contents</B
88></DT
89><DT
90><A
91HREF="sdlnumjoysticks.html"
92>SDL_NumJoysticks</A
93>&nbsp;--&nbsp;Count available joysticks.</DT
94><DT
95><A
96HREF="sdljoystickname.html"
97>SDL_JoystickName</A
98>&nbsp;--&nbsp;Get joystick name.</DT
99><DT
100><A
101HREF="sdljoystickopen.html"
102>SDL_JoystickOpen</A
103>&nbsp;--&nbsp;Opens a joystick for use.</DT
104><DT
105><A
106HREF="sdljoystickopened.html"
107>SDL_JoystickOpened</A
108>&nbsp;--&nbsp;Determine if a joystick has been opened</DT
109><DT
110><A
111HREF="sdljoystickindex.html"
112>SDL_JoystickIndex</A
113>&nbsp;--&nbsp;Get the index of an SDL_Joystick.</DT
114><DT
115><A
116HREF="sdljoysticknumaxes.html"
117>SDL_JoystickNumAxes</A
118>&nbsp;--&nbsp;Get the number of joystick axes</DT
119><DT
120><A
121HREF="sdljoysticknumballs.html"
122>SDL_JoystickNumBalls</A
123>&nbsp;--&nbsp;Get the number of joystick trackballs</DT
124><DT
125><A
126HREF="sdljoysticknumhats.html"
127>SDL_JoystickNumHats</A
128>&nbsp;--&nbsp;Get the number of joystick hats</DT
129><DT
130><A
131HREF="sdljoysticknumbuttons.html"
132>SDL_JoystickNumButtons</A
133>&nbsp;--&nbsp;Get the number of joysitck buttons</DT
134><DT
135><A
136HREF="sdljoystickupdate.html"
137>SDL_JoystickUpdate</A
138>&nbsp;--&nbsp;Updates the state of all joysticks</DT
139><DT
140><A
141HREF="sdljoystickgetaxis.html"
142>SDL_JoystickGetAxis</A
143>&nbsp;--&nbsp;Get the current state of an axis</DT
144><DT
145><A
146HREF="sdljoystickgethat.html"
147>SDL_JoystickGetHat</A
148>&nbsp;--&nbsp;Get the current state of a joystick hat</DT
149><DT
150><A
151HREF="sdljoystickgetbutton.html"
152>SDL_JoystickGetButton</A
153>&nbsp;--&nbsp;Get the current state of a given button on a given joystick</DT
154><DT
155><A
156HREF="sdljoystickgetball.html"
157>SDL_JoystickGetBall</A
158>&nbsp;--&nbsp;Get relative trackball motion</DT
159><DT
160><A
161HREF="sdljoystickclose.html"
162>SDL_JoystickClose</A
163>&nbsp;--&nbsp;Closes a previously opened joystick</DT
164></DL
165></DIV
166><P
167>Joysticks, and other similar input devices, have a very strong role in game playing and SDL provides comprehensive support for them. Axes, Buttons, POV Hats and trackballs are all supported.</P
168><P
169>Joystick support is initialized by passed the <TT
170CLASS="LITERAL"
171>SDL_INIT_JOYSTICK</TT
172> flag to <A
173HREF="sdlinit.html"
174><TT
175CLASS="FUNCTION"
176>SDL_Init</TT
177></A
178>. Once initilized joysticks must be opened using <A
179HREF="sdljoystickopen.html"
180><TT
181CLASS="FUNCTION"
182>SDL_JoystickOpen</TT
183></A
184>.</P
185><P
186>While using the functions describe in this secton may seem like the best way to access and read from joysticks, in most cases they aren't. Ideally joysticks should be read using the <A
187HREF="event.html"
188>event</A
189> system. To enable this, you must set the joystick event processing state with <A
190HREF="sdljoystickeventstate.html"
191><TT
192CLASS="FUNCTION"
193>SDL_JoystickEventState</TT
194></A
195>. Joysticks must be <A
196HREF="sdljoystickopen.html"
197>opened</A
198> before they can be used of course.</P
199><DIV
200CLASS="NOTE"
201><BLOCKQUOTE
202CLASS="NOTE"
203><P
204><B
205>Note: </B
206>If you are <SPAN
207CLASS="emphasis"
208><I
209CLASS="EMPHASIS"
210>not</I
211></SPAN
212> handling the joystick via the event queue then you must explicitly request a joystick update by calling <A
213HREF="sdljoystickupdate.html"
214><TT
215CLASS="FUNCTION"
216>SDL_JoystickUpdate</TT
217></A
218>.</P
219></BLOCKQUOTE
220></DIV
221><DIV
222CLASS="NOTE"
223><BLOCKQUOTE
224CLASS="NOTE"
225><P
226><B
227>Note: </B
228>Force Feedback is not yet support. Sam (slouken@libsdl.org) is soliciting suggestions from people with force-feedback experience on the best wat to desgin the API.</P
229></BLOCKQUOTE
230></DIV
231></DIV
232><DIV
233CLASS="NAVFOOTER"
234><HR
235ALIGN="LEFT"
236WIDTH="100%"><TABLE
237SUMMARY="Footer navigation table"
238WIDTH="100%"
239BORDER="0"
240CELLPADDING="0"
241CELLSPACING="0"
242><TR
243><TD
244WIDTH="33%"
245ALIGN="left"
246VALIGN="top"
247><A
248HREF="sdljoystickeventstate.html"
249ACCESSKEY="P"
250>Prev</A
251></TD
252><TD
253WIDTH="34%"
254ALIGN="center"
255VALIGN="top"
256><A
257HREF="index.html"
258ACCESSKEY="H"
259>Home</A
260></TD
261><TD
262WIDTH="33%"
263ALIGN="right"
264VALIGN="top"
265><A
266HREF="sdlnumjoysticks.html"
267ACCESSKEY="N"
268>Next</A
269></TD
270></TR
271><TR
272><TD
273WIDTH="33%"
274ALIGN="left"
275VALIGN="top"
276>SDL_JoystickEventState</TD
277><TD
278WIDTH="34%"
279ALIGN="center"
280VALIGN="top"
281><A
282HREF="reference.html"
283ACCESSKEY="U"
284>Up</A
285></TD
286><TD
287WIDTH="33%"
288ALIGN="right"
289VALIGN="top"
290>SDL_NumJoysticks</TD
291></TR
292></TABLE
293></DIV
294></BODY
295></HTML
296>