Mercurial > sdl-ios-xcode
annotate docs/html/sdlkeyboardevent.html @ 765:4c2ba6161939
Editors Note: The original patch was modified to use SDL_Delay() instead of
nanosleep because nanosleep may not be portable to all systems
using SDL with the ALSA backend. This may be a moot point with
the switch to blocking writes anyway...
Date: Sat, 27 Dec 2003 21:47:36 +0100
From: Michel Daenzer
To: Debian Bug Tracking System
Subject: [SDL] Bug#225252: [PATCH] ALSA fixes
Package: libsdl1.2debian-all
Version: 1.2.6-2
Severity: normal
Tags: patch
For SDL 1.2.6, the ALSA backend was changed to call snd_pcm_open() with
SND_PCM_NONBLOCK. That's a good idea per se, however, it causes high CPU
usage, interrupted sound and stuttering in some games here. Taking a nanosleep
whenever snd_pcm_writei() returns -EAGAIN fixes this, but I think it's more
efficient to use blocking mode for the actual sound playback. Feedback from the
SDL and ALSA lists appreciated.
The patch also fixes the default ALSA device to be used.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 04 Jan 2004 15:40:50 +0000 |
parents | e5bc29de3f0a |
children | 355632dca928 |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_KeyboardEvent</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
55
55f1f1b3e27d
Added new docs for SDL 1.2.1
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64 |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="SDL Event Structures." | |
14 HREF="eventstructures.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_ActiveEvent" | |
17 HREF="sdlactiveevent.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_MouseMotionEvent" | |
20 HREF="sdlmousemotionevent.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 | |
31 WIDTH="100%" | |
32 BORDER="0" | |
33 CELLPADDING="0" | |
34 CELLSPACING="0" | |
35 ><TR | |
36 ><TH | |
37 COLSPAN="3" | |
38 ALIGN="center" | |
39 >SDL Library Documentation</TH | |
40 ></TR | |
41 ><TR | |
42 ><TD | |
43 WIDTH="10%" | |
44 ALIGN="left" | |
45 VALIGN="bottom" | |
46 ><A | |
47 HREF="sdlactiveevent.html" | |
48 >Prev</A | |
49 ></TD | |
50 ><TD | |
51 WIDTH="80%" | |
52 ALIGN="center" | |
53 VALIGN="bottom" | |
54 ></TD | |
55 ><TD | |
56 WIDTH="10%" | |
57 ALIGN="right" | |
58 VALIGN="bottom" | |
59 ><A | |
60 HREF="sdlmousemotionevent.html" | |
61 >Next</A | |
62 ></TD | |
63 ></TR | |
64 ></TABLE | |
65 ><HR | |
66 ALIGN="LEFT" | |
67 WIDTH="100%"></DIV | |
68 ><H1 | |
69 ><A | |
70 NAME="SDLKEYBOARDEVENT" | |
71 >SDL_KeyboardEvent</A | |
72 ></H1 | |
73 ><DIV | |
74 CLASS="REFNAMEDIV" | |
75 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
76 NAME="AEN3627" |
0 | 77 ></A |
78 ><H2 | |
79 >Name</H2 | |
80 >SDL_KeyboardEvent -- Keyboard event structure</DIV | |
81 ><DIV | |
82 CLASS="REFSECT1" | |
83 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
84 NAME="AEN3630" |
0 | 85 ></A |
86 ><H2 | |
87 >Structure Definition</H2 | |
88 ><PRE | |
89 CLASS="PROGRAMLISTING" | |
90 >typedef struct{ | |
91 Uint8 type; | |
92 Uint8 state; | |
93 SDL_keysym keysym; | |
94 } SDL_KeyboardEvent;</PRE | |
95 ></DIV | |
96 ><DIV | |
97 CLASS="REFSECT1" | |
98 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
99 NAME="AEN3633" |
0 | 100 ></A |
101 ><H2 | |
102 >Structure Data</H2 | |
103 ><DIV | |
104 CLASS="INFORMALTABLE" | |
105 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
106 NAME="AEN3635" |
0 | 107 ></A |
108 ><P | |
109 ></P | |
110 ><TABLE | |
111 BORDER="0" | |
112 CLASS="CALSTABLE" | |
113 ><TBODY | |
114 ><TR | |
115 ><TD | |
116 ALIGN="LEFT" | |
117 VALIGN="TOP" | |
118 ><TT | |
119 CLASS="STRUCTFIELD" | |
120 ><I | |
121 >type</I | |
122 ></TT | |
123 ></TD | |
124 ><TD | |
125 ALIGN="LEFT" | |
126 VALIGN="TOP" | |
127 ><TT | |
128 CLASS="LITERAL" | |
129 >SDL_KEYDOWN</TT | |
130 > or <TT | |
131 CLASS="LITERAL" | |
132 >SDL_KEYUP</TT | |
133 ></TD | |
134 ></TR | |
135 ><TR | |
136 ><TD | |
137 ALIGN="LEFT" | |
138 VALIGN="TOP" | |
139 ><TT | |
140 CLASS="STRUCTFIELD" | |
141 ><I | |
142 >state</I | |
143 ></TT | |
144 ></TD | |
145 ><TD | |
146 ALIGN="LEFT" | |
147 VALIGN="TOP" | |
148 ><TT | |
149 CLASS="LITERAL" | |
150 >SDL_PRESSED</TT | |
151 > or <TT | |
152 CLASS="LITERAL" | |
153 >SDL_RELEASED</TT | |
154 ></TD | |
155 ></TR | |
156 ><TR | |
157 ><TD | |
158 ALIGN="LEFT" | |
159 VALIGN="TOP" | |
160 ><TT | |
161 CLASS="STRUCTFIELD" | |
162 ><I | |
163 >keysym</I | |
164 ></TT | |
165 ></TD | |
166 ><TD | |
167 ALIGN="LEFT" | |
168 VALIGN="TOP" | |
169 >Contains key press information</TD | |
170 ></TR | |
171 ></TBODY | |
172 ></TABLE | |
173 ><P | |
174 ></P | |
175 ></DIV | |
176 ></DIV | |
177 ><DIV | |
178 CLASS="REFSECT1" | |
179 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
180 NAME="AEN3654" |
0 | 181 ></A |
182 ><H2 | |
183 >Description</H2 | |
184 ><P | |
185 ><SPAN | |
186 CLASS="STRUCTNAME" | |
187 >SDL_KeyboardEvent</SPAN | |
188 > is a member of the <A | |
189 HREF="sdlevent.html" | |
190 ><SPAN | |
191 CLASS="STRUCTNAME" | |
192 >SDL_Event</SPAN | |
193 ></A | |
194 > union and is used when an event of type <TT | |
195 CLASS="LITERAL" | |
196 >SDL_KEYDOWN</TT | |
197 > or <TT | |
198 CLASS="LITERAL" | |
199 >SDL_KEYUP</TT | |
200 > is reported.</P | |
201 ><P | |
202 >The <TT | |
203 CLASS="STRUCTFIELD" | |
204 ><I | |
205 >type</I | |
206 ></TT | |
207 > and <TT | |
208 CLASS="STRUCTFIELD" | |
209 ><I | |
210 >state</I | |
211 ></TT | |
212 > actually report the same information, they just use different values to do it! A keyboard event occurs when a key is released (<TT | |
213 CLASS="STRUCTFIELD" | |
214 ><I | |
215 >type</I | |
216 ></TT | |
217 >=<TT | |
218 CLASS="LITERAL" | |
219 >SDK_KEYUP</TT | |
220 > or <TT | |
221 CLASS="STRUCTFIELD" | |
222 ><I | |
223 >state</I | |
224 ></TT | |
225 >=<TT | |
226 CLASS="LITERAL" | |
227 >SDL_RELEASED</TT | |
228 >) and when a key is pressed (<TT | |
229 CLASS="STRUCTFIELD" | |
230 ><I | |
231 >type</I | |
232 ></TT | |
233 >=<TT | |
234 CLASS="LITERAL" | |
235 >SDL_KEYDOWN</TT | |
236 > or <TT | |
237 CLASS="STRUCTFIELD" | |
238 ><I | |
239 >state</I | |
240 ></TT | |
241 >=<TT | |
242 CLASS="LITERAL" | |
243 >SDL_PRESSED</TT | |
244 >). The information on what key was pressed or released is in the <A | |
245 HREF="sdlkeysym.html" | |
246 ><SPAN | |
247 CLASS="STRUCTNAME" | |
248 >keysym</SPAN | |
249 ></A | |
250 > structure.</P | |
251 ><DIV | |
252 CLASS="NOTE" | |
253 ><BLOCKQUOTE | |
254 CLASS="NOTE" | |
255 ><P | |
256 ><B | |
257 >Note: </B | |
258 >Repeating <TT | |
259 CLASS="LITERAL" | |
260 >SDL_KEYDOWN</TT | |
261 > events will occur if key repeat is enabled (see <A | |
262 HREF="sdlenablekeyrepeat.html" | |
263 ><TT | |
264 CLASS="FUNCTION" | |
265 >SDL_EnableKeyRepeat</TT | |
266 ></A | |
267 >).</P | |
268 ></BLOCKQUOTE | |
269 ></DIV | |
270 ></DIV | |
271 ><DIV | |
272 CLASS="REFSECT1" | |
273 ><A | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
274 NAME="AEN3680" |
0 | 275 ></A |
276 ><H2 | |
277 >See Also</H2 | |
278 ><P | |
279 ><A | |
280 HREF="sdlevent.html" | |
281 ><SPAN | |
282 CLASS="STRUCTNAME" | |
283 >SDL_Event</SPAN | |
284 ></A | |
285 >, | |
286 <A | |
287 HREF="sdlkeysym.html" | |
288 ><SPAN | |
289 CLASS="STRUCTNAME" | |
290 >SDL_keysym</SPAN | |
291 ></A | |
292 >, | |
293 <A | |
294 HREF="sdlenablekeyrepeat.html" | |
295 ><TT | |
296 CLASS="FUNCTION" | |
297 >SDL_EnableKeyRepeat</TT | |
298 ></A | |
299 >, | |
300 <A | |
301 HREF="sdlenableunicode.html" | |
302 ><TT | |
303 CLASS="FUNCTION" | |
304 >SDL_EnableUNICODE</TT | |
305 ></A | |
306 ></P | |
307 ></DIV | |
308 ><DIV | |
309 CLASS="NAVFOOTER" | |
310 ><HR | |
311 ALIGN="LEFT" | |
312 WIDTH="100%"><TABLE | |
313 WIDTH="100%" | |
314 BORDER="0" | |
315 CELLPADDING="0" | |
316 CELLSPACING="0" | |
317 ><TR | |
318 ><TD | |
319 WIDTH="33%" | |
320 ALIGN="left" | |
321 VALIGN="top" | |
322 ><A | |
323 HREF="sdlactiveevent.html" | |
324 >Prev</A | |
325 ></TD | |
326 ><TD | |
327 WIDTH="34%" | |
328 ALIGN="center" | |
329 VALIGN="top" | |
330 ><A | |
331 HREF="index.html" | |
332 >Home</A | |
333 ></TD | |
334 ><TD | |
335 WIDTH="33%" | |
336 ALIGN="right" | |
337 VALIGN="top" | |
338 ><A | |
339 HREF="sdlmousemotionevent.html" | |
340 >Next</A | |
341 ></TD | |
342 ></TR | |
343 ><TR | |
344 ><TD | |
345 WIDTH="33%" | |
346 ALIGN="left" | |
347 VALIGN="top" | |
348 >SDL_ActiveEvent</TD | |
349 ><TD | |
350 WIDTH="34%" | |
351 ALIGN="center" | |
352 VALIGN="top" | |
353 ><A | |
354 HREF="eventstructures.html" | |
355 >Up</A | |
356 ></TD | |
357 ><TD | |
358 WIDTH="33%" | |
359 ALIGN="right" | |
360 VALIGN="top" | |
361 >SDL_MouseMotionEvent</TD | |
362 ></TR | |
363 ></TABLE | |
364 ></DIV | |
365 ></BODY | |
366 ></HTML | |
367 > |