comparison docs/html/joystick.html @ 0:74212992fb08

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