Mercurial > sdl-ios-xcode
annotate docs/html/event.html @ 968:4675910b0b7b
Date: Mon, 11 Oct 2004 15:17:27 +0300 (EEST)
From: Hannu Savolainen
Subject: Re: SDL uses obsolete OSS features
I did some work on getting OSS to work better with SDL. There have been
some problems with select which should be fixed now.
I'm having some problems in understanding what is the purpose of the
DSP_WaitAudio() routine. I added a return to the very beginning of this
routine and commendted out the define for USE_BLOCKING_WRITES. At least
lbreakout2 seems to work as well as earlier. The latencies are the same.
An ordinary blocking write does exactly the same thing than DSP_WaitAudio
does. So I would recommend using the USE_BLOCKING_WRITES approach and
removing everything from the DSP_WaitAudio routine. Also enabling
USE_BLOCKING_WRITES makes it possible to simplify DSP_PlayAudio() because
you don't need to handle the partial writes (the do-while loop).
Attached is a patch against SDL-1.2.7. After these changes SDL will use
OSS as it's designed to be used (make it as simple as possible). This code
should work with all OSS implementations because it uses only the very
fundamental features that have been there since the jurassic times.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 12 Nov 2004 21:39:04 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >Events</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="SDL Reference" | |
14 HREF="reference.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_WM_GrabInput" | |
17 HREF="sdlwmgrabinput.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL Event Structures." | |
20 HREF="eventstructures.html"><META | |
21 NAME="KEYWORD" | |
22 CONTENT="events"><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 | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
35 SUMMARY="Header navigation table" |
0 | 36 WIDTH="100%" |
37 BORDER="0" | |
38 CELLPADDING="0" | |
39 CELLSPACING="0" | |
40 ><TR | |
41 ><TH | |
42 COLSPAN="3" | |
43 ALIGN="center" | |
44 >SDL Library Documentation</TH | |
45 ></TR | |
46 ><TR | |
47 ><TD | |
48 WIDTH="10%" | |
49 ALIGN="left" | |
50 VALIGN="bottom" | |
51 ><A | |
52 HREF="sdlwmgrabinput.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
53 ACCESSKEY="P" |
0 | 54 >Prev</A |
55 ></TD | |
56 ><TD | |
57 WIDTH="80%" | |
58 ALIGN="center" | |
59 VALIGN="bottom" | |
60 ></TD | |
61 ><TD | |
62 WIDTH="10%" | |
63 ALIGN="right" | |
64 VALIGN="bottom" | |
65 ><A | |
66 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
67 ACCESSKEY="N" |
0 | 68 >Next</A |
69 ></TD | |
70 ></TR | |
71 ></TABLE | |
72 ><HR | |
73 ALIGN="LEFT" | |
74 WIDTH="100%"></DIV | |
75 ><DIV | |
76 CLASS="CHAPTER" | |
77 ><H1 | |
78 ><A | |
79 NAME="EVENT" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
80 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
81 >Chapter 8. Events</H1 |
0 | 82 ><DIV |
83 CLASS="TOC" | |
84 ><DL | |
85 ><DT | |
86 ><B | |
87 >Table of Contents</B | |
88 ></DT | |
89 ><DT | |
90 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
91 HREF="event.html#AEN3691" |
0 | 92 >Introduction</A |
93 ></DT | |
94 ><DT | |
95 ><A | |
96 HREF="eventstructures.html" | |
97 >SDL Event Structures.</A | |
98 ></DT | |
99 ><DT | |
100 ><A | |
101 HREF="eventfunctions.html" | |
102 >Event Functions.</A | |
103 ></DT | |
104 ></DL | |
105 ></DIV | |
106 ><DIV | |
107 CLASS="SECT1" | |
108 ><H1 | |
109 CLASS="SECT1" | |
110 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
111 NAME="AEN3691" |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
112 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
113 >Introduction</H1 |
0 | 114 ><P |
115 >Event handling allows your application to receive input from the user. Event handling is initalised (along with video) with a call to: | |
116 <PRE | |
117 CLASS="PROGRAMLISTING" | |
118 >SDL_Init(SDL_INIT_VIDEO);</PRE | |
119 > | |
181
e5bc29de3f0a
Updated from the SDL Documentation Project
Sam Lantinga <slouken@libsdl.org>
parents:
55
diff
changeset
|
120 Internally, SDL stores all the events waiting to be handled in an event queue. Using functions like <A |
0 | 121 HREF="sdlpollevent.html" |
122 ><TT | |
123 CLASS="FUNCTION" | |
124 >SDL_PollEvent</TT | |
125 ></A | |
126 > and <A | |
127 HREF="sdlpeepevents.html" | |
128 ><TT | |
129 CLASS="FUNCTION" | |
130 >SDL_PeepEvents</TT | |
131 ></A | |
132 > you can observe and handle waiting input events.</P | |
133 ><P | |
134 >The key to event handling in SDL is the <A | |
135 HREF="sdlevent.html" | |
136 ><SPAN | |
137 CLASS="STRUCTNAME" | |
138 >SDL_Event</SPAN | |
139 ></A | |
140 > union. The event queue itself is composed of a series of <SPAN | |
141 CLASS="STRUCTNAME" | |
142 >SDL_Event</SPAN | |
143 > unions, one for each waiting event. <SPAN | |
144 CLASS="STRUCTNAME" | |
145 >SDL_Event</SPAN | |
146 > unions are read from the queue with the <TT | |
147 CLASS="FUNCTION" | |
148 >SDL_PollEvent</TT | |
149 > function and it is then up to the application to process the information stored with them.</P | |
150 ></DIV | |
151 ></DIV | |
152 ><DIV | |
153 CLASS="NAVFOOTER" | |
154 ><HR | |
155 ALIGN="LEFT" | |
156 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
157 SUMMARY="Footer navigation table" |
0 | 158 WIDTH="100%" |
159 BORDER="0" | |
160 CELLPADDING="0" | |
161 CELLSPACING="0" | |
162 ><TR | |
163 ><TD | |
164 WIDTH="33%" | |
165 ALIGN="left" | |
166 VALIGN="top" | |
167 ><A | |
168 HREF="sdlwmgrabinput.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
169 ACCESSKEY="P" |
0 | 170 >Prev</A |
171 ></TD | |
172 ><TD | |
173 WIDTH="34%" | |
174 ALIGN="center" | |
175 VALIGN="top" | |
176 ><A | |
177 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
178 ACCESSKEY="H" |
0 | 179 >Home</A |
180 ></TD | |
181 ><TD | |
182 WIDTH="33%" | |
183 ALIGN="right" | |
184 VALIGN="top" | |
185 ><A | |
186 HREF="eventstructures.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
187 ACCESSKEY="N" |
0 | 188 >Next</A |
189 ></TD | |
190 ></TR | |
191 ><TR | |
192 ><TD | |
193 WIDTH="33%" | |
194 ALIGN="left" | |
195 VALIGN="top" | |
196 >SDL_WM_GrabInput</TD | |
197 ><TD | |
198 WIDTH="34%" | |
199 ALIGN="center" | |
200 VALIGN="top" | |
201 ><A | |
202 HREF="reference.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
203 ACCESSKEY="U" |
0 | 204 >Up</A |
205 ></TD | |
206 ><TD | |
207 WIDTH="33%" | |
208 ALIGN="right" | |
209 VALIGN="top" | |
210 >SDL Event Structures.</TD | |
211 ></TR | |
212 ></TABLE | |
213 ></DIV | |
214 ></BODY | |
215 ></HTML | |
216 > |