1<HTML 2><HEAD 3><TITLE 4>SDL_PeepEvents</TITLE 5><META 6NAME="GENERATOR" 7CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ 8"><LINK 9REL="HOME" 10TITLE="SDL Library Documentation" 11HREF="index.html"><LINK 12REL="UP" 13TITLE="Event Functions." 14HREF="eventfunctions.html"><LINK 15REL="PREVIOUS" 16TITLE="SDL_PumpEvents" 17HREF="sdlpumpevents.html"><LINK 18REL="NEXT" 19TITLE="SDL_PollEvent" 20HREF="sdlpollevent.html"></HEAD 21><BODY 22CLASS="REFENTRY" 23BGCOLOR="#FFF8DC" 24TEXT="#000000" 25LINK="#0000ee" 26VLINK="#551a8b" 27ALINK="#ff0000" 28><DIV 29CLASS="NAVHEADER" 30><TABLE 31SUMMARY="Header navigation table" 32WIDTH="100%" 33BORDER="0" 34CELLPADDING="0" 35CELLSPACING="0" 36><TR 37><TH 38COLSPAN="3" 39ALIGN="center" 40>SDL Library Documentation</TH 41></TR 42><TR 43><TD 44WIDTH="10%" 45ALIGN="left" 46VALIGN="bottom" 47><A 48HREF="sdlpumpevents.html" 49ACCESSKEY="P" 50>Prev</A 51></TD 52><TD 53WIDTH="80%" 54ALIGN="center" 55VALIGN="bottom" 56></TD 57><TD 58WIDTH="10%" 59ALIGN="right" 60VALIGN="bottom" 61><A 62HREF="sdlpollevent.html" 63ACCESSKEY="N" 64>Next</A 65></TD 66></TR 67></TABLE 68><HR 69ALIGN="LEFT" 70WIDTH="100%"></DIV 71><H1 72><A 73NAME="SDLPEEPEVENTS" 74></A 75>SDL_PeepEvents</H1 76><DIV 77CLASS="REFNAMEDIV" 78><A 79NAME="AEN5421" 80></A 81><H2 82>Name</H2 83>SDL_PeepEvents -- Checks the event queue for messages and optionally returns them.</DIV 84><DIV 85CLASS="REFSYNOPSISDIV" 86><A 87NAME="AEN5424" 88></A 89><H2 90>Synopsis</H2 91><DIV 92CLASS="FUNCSYNOPSIS" 93><A 94NAME="AEN5425" 95></A 96><P 97></P 98><PRE 99CLASS="FUNCSYNOPSISINFO" 100>#include "SDL.h"</PRE 101><P 102><CODE 103><CODE 104CLASS="FUNCDEF" 105>int <B 106CLASS="FSFUNC" 107>SDL_PeepEvents</B 108></CODE 109>(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 mask);</CODE 110></P 111><P 112></P 113></DIV 114></DIV 115><DIV 116CLASS="REFSECT1" 117><A 118NAME="AEN5431" 119></A 120><H2 121>Description</H2 122><P 123>Checks the event queue for messages and optionally returns them.</P 124><P 125>If <TT 126CLASS="PARAMETER" 127><I 128>action</I 129></TT 130> is <TT 131CLASS="LITERAL" 132>SDL_ADDEVENT</TT 133>, up to 134<TT 135CLASS="PARAMETER" 136><I 137>numevents</I 138></TT 139> events will be added to the back of the event 140 queue.</P 141><P 142>If <TT 143CLASS="PARAMETER" 144><I 145>action</I 146></TT 147> is <TT 148CLASS="LITERAL" 149>SDL_PEEKEVENT</TT 150>, up to 151<TT 152CLASS="PARAMETER" 153><I 154>numevents</I 155></TT 156> events at the front of the event queue, 157matching <A 158HREF="sdlevent.html" 159><TT 160CLASS="PARAMETER" 161><I 162>mask</I 163></TT 164></A 165>, 166will be returned and will not be removed from the queue.</P 167><P 168>If <TT 169CLASS="PARAMETER" 170><I 171>action</I 172></TT 173> is <TT 174CLASS="LITERAL" 175>SDL_GETEVENT</TT 176>, up to 177<TT 178CLASS="PARAMETER" 179><I 180>numevents</I 181></TT 182> events at the front of the event queue, 183matching <A 184HREF="sdlevent.html" 185><TT 186CLASS="PARAMETER" 187><I 188>mask</I 189></TT 190></A 191>, 192will be returned and will be removed from the queue.</P 193><P 194>The <TT 195CLASS="PARAMETER" 196><I 197>mask</I 198></TT 199> parameter is an bitwise OR of 200<TT 201CLASS="LITERAL" 202>SDL_EVENTMASK</TT 203>(<TT 204CLASS="PARAMETER" 205><I 206>event_type</I 207></TT 208>), for all 209event types you are interested in.</P 210><P 211>This function is thread-safe.</P 212></DIV 213><DIV 214CLASS="REFSECT1" 215><A 216NAME="AEN5455" 217></A 218><H2 219>Return Value</H2 220><P 221>This function returns the number of events actually stored, or 222<SPAN 223CLASS="RETURNVALUE" 224>-1</SPAN 225> if there was an error. </P 226></DIV 227><DIV 228CLASS="REFSECT1" 229><A 230NAME="AEN5459" 231></A 232><H2 233>See Also</H2 234><P 235><A 236HREF="sdlevent.html" 237><SPAN 238CLASS="STRUCTNAME" 239>SDL_Event</SPAN 240></A 241>, 242<A 243HREF="sdlpollevent.html" 244><TT 245CLASS="FUNCTION" 246>SDL_PollEvent</TT 247></A 248>, 249<A 250HREF="sdlpushevent.html" 251><TT 252CLASS="FUNCTION" 253>SDL_PushEvent</TT 254></A 255></P 256></DIV 257><DIV 258CLASS="NAVFOOTER" 259><HR 260ALIGN="LEFT" 261WIDTH="100%"><TABLE 262SUMMARY="Footer navigation table" 263WIDTH="100%" 264BORDER="0" 265CELLPADDING="0" 266CELLSPACING="0" 267><TR 268><TD 269WIDTH="33%" 270ALIGN="left" 271VALIGN="top" 272><A 273HREF="sdlpumpevents.html" 274ACCESSKEY="P" 275>Prev</A 276></TD 277><TD 278WIDTH="34%" 279ALIGN="center" 280VALIGN="top" 281><A 282HREF="index.html" 283ACCESSKEY="H" 284>Home</A 285></TD 286><TD 287WIDTH="33%" 288ALIGN="right" 289VALIGN="top" 290><A 291HREF="sdlpollevent.html" 292ACCESSKEY="N" 293>Next</A 294></TD 295></TR 296><TR 297><TD 298WIDTH="33%" 299ALIGN="left" 300VALIGN="top" 301>SDL_PumpEvents</TD 302><TD 303WIDTH="34%" 304ALIGN="center" 305VALIGN="top" 306><A 307HREF="eventfunctions.html" 308ACCESSKEY="U" 309>Up</A 310></TD 311><TD 312WIDTH="33%" 313ALIGN="right" 314VALIGN="top" 315>SDL_PollEvent</TD 316></TR 317></TABLE 318></DIV 319></BODY 320></HTML 321>