Mercurial > sdl-ios-xcode
annotate docs/html/sdljoystickgetaxis.html @ 4170:092c0bc69155 SDL-1.2
Fixed bug #618
Description From Tim Angus 2008-08-30 12:23:56 (-) [reply]
As we all know SDL 1.2 doesn't handle dead keys well since one key press
potentially equals two (or more) characters. For example, on many layouts,
keying <backquote>,<space> results in <no character>,<backquote><space>. Since
the unicode member of the SDL_keysym struct only has room for one character,
only one can be returned.
On Linux, the first character is returned. On Windows however, unless the exact
number of characters generated by the keypress is 1, nothing is returned. The
following patch addresses this inconsistency.
Updated patch which includes a further fix to the handling of the numpad when
numlock is on. This further fix is courtesy Amanieu d'Antras.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 13 Apr 2009 08:42:09 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_JoystickGetAxis</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="Joystick" | |
14 HREF="joystick.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_JoystickUpdate" | |
17 HREF="sdljoystickupdate.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_JoystickGetHat" | |
20 HREF="sdljoystickgethat.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
23 BGCOLOR="#FFF8DC" | |
24 TEXT="#000000" | |
25 LINK="#0000ee" | |
26 VLINK="#551a8b" | |
27 ALINK="#ff0000" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
31 SUMMARY="Header navigation table" |
0 | 32 WIDTH="100%" |
33 BORDER="0" | |
34 CELLPADDING="0" | |
35 CELLSPACING="0" | |
36 ><TR | |
37 ><TH | |
38 COLSPAN="3" | |
39 ALIGN="center" | |
40 >SDL Library Documentation</TH | |
41 ></TR | |
42 ><TR | |
43 ><TD | |
44 WIDTH="10%" | |
45 ALIGN="left" | |
46 VALIGN="bottom" | |
47 ><A | |
48 HREF="sdljoystickupdate.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
49 ACCESSKEY="P" |
0 | 50 >Prev</A |
51 ></TD | |
52 ><TD | |
53 WIDTH="80%" | |
54 ALIGN="center" | |
55 VALIGN="bottom" | |
56 ></TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="sdljoystickgethat.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
63 ACCESSKEY="N" |
0 | 64 >Next</A |
65 ></TD | |
66 ></TR | |
67 ></TABLE | |
68 ><HR | |
69 ALIGN="LEFT" | |
70 WIDTH="100%"></DIV | |
71 ><H1 | |
72 ><A | |
73 NAME="SDLJOYSTICKGETAXIS" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
74 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
75 >SDL_JoystickGetAxis</H1 |
0 | 76 ><DIV |
77 CLASS="REFNAMEDIV" | |
78 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
79 NAME="AEN6320" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_JoystickGetAxis -- Get the current state of an axis</DIV | |
84 ><DIV | |
85 CLASS="REFSYNOPSISDIV" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN6323" |
0 | 88 ></A |
89 ><H2 | |
90 >Synopsis</H2 | |
91 ><DIV | |
92 CLASS="FUNCSYNOPSIS" | |
93 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
94 NAME="AEN6324" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
100 >#include "SDL.h"</PRE | |
101 ><P | |
102 ><CODE | |
103 ><CODE | |
104 CLASS="FUNCDEF" | |
105 >Sint16 <B | |
106 CLASS="FSFUNC" | |
107 >SDL_JoystickGetAxis</B | |
108 ></CODE | |
109 >(SDL_Joystick *joystick, int axis);</CODE | |
110 ></P | |
111 ><P | |
112 ></P | |
113 ></DIV | |
114 ></DIV | |
115 ><DIV | |
116 CLASS="REFSECT1" | |
117 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
118 NAME="AEN6330" |
0 | 119 ></A |
120 ><H2 | |
121 >Description</H2 | |
122 ><P | |
123 ><TT | |
124 CLASS="FUNCTION" | |
125 >SDL_JoystickGetAxis</TT | |
126 > returns the current state of the given <TT | |
127 CLASS="PARAMETER" | |
128 ><I | |
129 >axis</I | |
130 ></TT | |
131 > on the given <TT | |
132 CLASS="PARAMETER" | |
133 ><I | |
134 >joystick</I | |
135 ></TT | |
136 >.</P | |
137 ><P | |
138 >On most modern joysticks the X axis is usually represented by <TT | |
139 CLASS="PARAMETER" | |
140 ><I | |
141 >axis</I | |
142 ></TT | |
143 > 0 and the Y axis by <TT | |
144 CLASS="PARAMETER" | |
145 ><I | |
146 >axis</I | |
147 ></TT | |
148 > 1. The value returned by <TT | |
149 CLASS="FUNCTION" | |
150 >SDL_JoystickGetAxis</TT | |
151 > is a signed integer (-32768 to 32768) representing the current position of the <TT | |
152 CLASS="PARAMETER" | |
153 ><I | |
154 >axis</I | |
155 ></TT | |
156 >, it maybe necessary to impose certain tolerances on these values to account for jitter. It is worth noting that some joysticks use axes 2 and 3 for extra buttons.</P | |
157 ></DIV | |
158 ><DIV | |
159 CLASS="REFSECT1" | |
160 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
161 NAME="AEN6341" |
0 | 162 ></A |
163 ><H2 | |
164 >Return Value</H2 | |
165 ><P | |
166 >Returns a 16-bit signed integer representing the current position of the <TT | |
167 CLASS="PARAMETER" | |
168 ><I | |
169 >axis</I | |
170 ></TT | |
171 >.</P | |
172 ></DIV | |
173 ><DIV | |
174 CLASS="REFSECT1" | |
175 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
176 NAME="AEN6345" |
0 | 177 ></A |
178 ><H2 | |
179 >Examples</H2 | |
180 ><P | |
181 ><PRE | |
182 CLASS="PROGRAMLISTING" | |
183 >Sint16 x_move, y_move; | |
184 SDL_Joystick *joy1; | |
185 . | |
186 . | |
187 x_move=SDL_JoystickGetAxis(joy1, 0); | |
188 y_move=SDL_JoystickGetAxis(joy1, 1);</PRE | |
189 ></P | |
190 ></DIV | |
191 ><DIV | |
192 CLASS="REFSECT1" | |
193 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
194 NAME="AEN6349" |
0 | 195 ></A |
196 ><H2 | |
197 >See Also</H2 | |
198 ><P | |
199 ><A | |
200 HREF="sdljoysticknumaxes.html" | |
201 ><TT | |
202 CLASS="FUNCTION" | |
203 >SDL_JoystickNumAxes</TT | |
204 ></A | |
205 ></P | |
206 ></DIV | |
207 ><DIV | |
208 CLASS="NAVFOOTER" | |
209 ><HR | |
210 ALIGN="LEFT" | |
211 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
212 SUMMARY="Footer navigation table" |
0 | 213 WIDTH="100%" |
214 BORDER="0" | |
215 CELLPADDING="0" | |
216 CELLSPACING="0" | |
217 ><TR | |
218 ><TD | |
219 WIDTH="33%" | |
220 ALIGN="left" | |
221 VALIGN="top" | |
222 ><A | |
223 HREF="sdljoystickupdate.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
224 ACCESSKEY="P" |
0 | 225 >Prev</A |
226 ></TD | |
227 ><TD | |
228 WIDTH="34%" | |
229 ALIGN="center" | |
230 VALIGN="top" | |
231 ><A | |
232 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
233 ACCESSKEY="H" |
0 | 234 >Home</A |
235 ></TD | |
236 ><TD | |
237 WIDTH="33%" | |
238 ALIGN="right" | |
239 VALIGN="top" | |
240 ><A | |
241 HREF="sdljoystickgethat.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
242 ACCESSKEY="N" |
0 | 243 >Next</A |
244 ></TD | |
245 ></TR | |
246 ><TR | |
247 ><TD | |
248 WIDTH="33%" | |
249 ALIGN="left" | |
250 VALIGN="top" | |
251 >SDL_JoystickUpdate</TD | |
252 ><TD | |
253 WIDTH="34%" | |
254 ALIGN="center" | |
255 VALIGN="top" | |
256 ><A | |
257 HREF="joystick.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
258 ACCESSKEY="U" |
0 | 259 >Up</A |
260 ></TD | |
261 ><TD | |
262 WIDTH="33%" | |
263 ALIGN="right" | |
264 VALIGN="top" | |
265 >SDL_JoystickGetHat</TD | |
266 ></TR | |
267 ></TABLE | |
268 ></DIV | |
269 ></BODY | |
270 ></HTML | |
271 > |