SDL-1.2.14
[sdl_omap.git] / docs / html / event.html
1 <HTML
2 ><HEAD
3 ><TITLE
4 >Events</TITLE
5 ><META
6 NAME="GENERATOR"
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
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
35 SUMMARY="Header navigation table"
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"
53 ACCESSKEY="P"
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"
67 ACCESSKEY="N"
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"
80 ></A
81 >Chapter 8. Events</H1
82 ><DIV
83 CLASS="TOC"
84 ><DL
85 ><DT
86 ><B
87 >Table of Contents</B
88 ></DT
89 ><DT
90 ><A
91 HREF="event.html#AEN3691"
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
111 NAME="AEN3691"
112 ></A
113 >Introduction</H1
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 >
120 Internally, SDL stores all the events waiting to be handled in an event queue. Using functions like <A
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
157 SUMMARY="Footer navigation table"
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"
169 ACCESSKEY="P"
170 >Prev</A
171 ></TD
172 ><TD
173 WIDTH="34%"
174 ALIGN="center"
175 VALIGN="top"
176 ><A
177 HREF="index.html"
178 ACCESSKEY="H"
179 >Home</A
180 ></TD
181 ><TD
182 WIDTH="33%"
183 ALIGN="right"
184 VALIGN="top"
185 ><A
186 HREF="eventstructures.html"
187 ACCESSKEY="N"
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"
203 ACCESSKEY="U"
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 >