Mercurial > sdl-ios-xcode
view docs/html/index.html @ 3069:caefe2344f65
Date: Thu, 27 Dec 2007 07:38:25 +0000
From: John Bartholomew
Subject: [SDL] SDL Semaphore implementation broken on Windows?
Hi,
Over the past couple of days, I've been battling with SDL, SDL_Mixer and SMPEG to try to find an audio hang bug. I believe I've found the problem, which I think is a race condition inside SDL's semaphore implementation (at least the Windows implementation). The semaphore code uses Windows' built in semaphore functions, but it also maintains a separate count value. This count value is updated with bare increment and decrement operations in SemPost and SemWaitTimeout - no locking primitives to protect them.
In tracking down the apparent audio bug, I found that at some point a semaphore's count value was being decremented to -1, which is clearly not a valid value for it to take.
I'm still not certain exactly what sequence of operations is occuring for this to happen, but I believe that overall it's a race condition between a thread calling SemPost (which increments the count) and the thread on the other end calling SemWait (which decrements it).
I will try to make a test case to verify this, but I'm not sure if I'll be able to (threading errors being difficult to reproduce even in the best circumstances).
However, assuming this is the cause of my problems, there is a very
simple fix:
Windows provides InterlockedIncrement() and InterlockedDecrement()
functions to perform increments and decrements which are guaranteed to be atomic. So the fix is in thread/win32/SDL_syssem.c: replace occurrences of --sem->count with InterlockedDecrement(&sem->count); and replace occurrences of ++sem->count with InterlockedIncrement(&sem->count);
This is using SDL v1.2.12, built with VC++ 2008 Express, running on a
Core 2 duo processor.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 17 Feb 2009 05:39:18 +0000 |
parents | 355632dca928 |
children |
line wrap: on
line source
<HTML ><HEAD ><TITLE ></TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ "><LINK REL="NEXT" TITLE="SDL Guide" HREF="guide.html"></HEAD ><BODY CLASS="BOOK" BGCOLOR="#FFF8DC" TEXT="#000000" LINK="#0000ee" VLINK="#551a8b" ALINK="#ff0000" ><DIV CLASS="BOOK" ><A NAME="AEN1" ></A ><DIV CLASS="TOC" ><DL ><DT ><B >Table of Contents</B ></DT ><DT >I. <A HREF="guide.html" >SDL Guide</A ></DT ><DD ><DL ><DT ><A HREF="guidepreface.html" >Preface</A ></DT ><DD ><DL ><DT ><A HREF="guidepreface.html#GUIDEABOUTSDL" >About SDL</A ></DT ><DT ><A HREF="guideaboutsdldoc.html" >About SDLdoc</A ></DT ><DT ><A HREF="guidecredits.html" >Credits</A ></DT ></DL ></DD ><DT >1. <A HREF="guidethebasics.html" >The Basics</A ></DT ><DD ><DL ><DT ><A HREF="guidethebasics.html#GUIDEINTRODUCTION" >Introduction</A ></DT ><DT ><A HREF="guidebasicsinit.html" >Initializing SDL</A ></DT ></DL ></DD ><DT >2. <A HREF="guidevideo.html" >Graphics and Video</A ></DT ><DD ><DL ><DT ><A HREF="guidevideo.html#GUIDEVIDEOINTRO" >Introduction to SDL Video</A ></DT ><DT ><A HREF="guidevideoopengl.html" >Using OpenGL With SDL</A ></DT ></DL ></DD ><DT >3. <A HREF="guideinput.html" >Input handling</A ></DT ><DD ><DL ><DT ><A HREF="guideinput.html#GUIDEINPUTJOYSTICK" >Handling Joysticks</A ></DT ><DT ><A HREF="guideinputkeyboard.html" >Handling the Keyboard</A ></DT ></DL ></DD ><DT >4. <A HREF="guideexamples.html" >Examples</A ></DT ><DD ><DL ><DT ><A HREF="guideexamples.html#AEN369" >Introduction</A ></DT ><DT ><A HREF="guideeventexamples.html" >Event Examples</A ></DT ><DT ><A HREF="guideaudioexamples.html" >Audio Examples</A ></DT ><DT ><A HREF="guidecdromexamples.html" >CDROM Examples</A ></DT ><DT ><A HREF="guidetimeexamples.html" >Time Examples</A ></DT ></DL ></DD ></DL ></DD ><DT >II. <A HREF="reference.html" >SDL Reference</A ></DT ><DD ><DL ><DT >5. <A HREF="general.html" >General</A ></DT ><DD ><DL ><DT ><A HREF="sdlinit.html" >SDL_Init</A > -- Initializes SDL</DT ><DT ><A HREF="sdlinitsubsystem.html" >SDL_InitSubSystem</A > -- Initialize subsystems</DT ><DT ><A HREF="sdlquitsubsystem.html" >SDL_QuitSubSystem</A > -- Shut down a subsystem</DT ><DT ><A HREF="sdlquit.html" >SDL_Quit</A > -- Shut down SDL</DT ><DT ><A HREF="sdlwasinit.html" >SDL_WasInit</A > -- Check which subsystems are initialized</DT ><DT ><A HREF="sdlgeterror.html" >SDL_GetError</A > -- Get SDL error string</DT ><DT ><A HREF="sdlenvvars.html" >SDL_envvars</A > -- SDL environment variables</DT ></DL ></DD ><DT >6. <A HREF="video.html" >Video</A ></DT ><DD ><DL ><DT ><A HREF="sdlgetvideosurface.html" >SDL_GetVideoSurface</A > -- returns a pointer to the current display surface</DT ><DT ><A HREF="sdlgetvideoinfo.html" >SDL_GetVideoInfo</A > -- returns a pointer to information about the video hardware</DT ><DT ><A HREF="sdlvideodrivername.html" >SDL_VideoDriverName</A > -- Obtain the name of the video driver</DT ><DT ><A HREF="sdllistmodes.html" >SDL_ListModes</A > -- Returns a pointer to an array of available screen dimensions for the given format and video flags</DT ><DT ><A HREF="sdlvideomodeok.html" >SDL_VideoModeOK</A > -- Check to see if a particular video mode is supported.</DT ><DT ><A HREF="sdlsetvideomode.html" >SDL_SetVideoMode</A > -- Set up a video mode with the specified width, height and bits-per-pixel.</DT ><DT ><A HREF="sdlupdaterect.html" >SDL_UpdateRect</A > -- Makes sure the given area is updated on the given screen.</DT ><DT ><A HREF="sdlupdaterects.html" >SDL_UpdateRects</A > -- Makes sure the given list of rectangles is updated on the given screen.</DT ><DT ><A HREF="sdlflip.html" >SDL_Flip</A > -- Swaps screen buffers</DT ><DT ><A HREF="sdlsetcolors.html" >SDL_SetColors</A > -- Sets a portion of the colormap for the given 8-bit surface.</DT ><DT ><A HREF="sdlsetpalette.html" >SDL_SetPalette</A > -- Sets the colors in the palette of an 8-bit surface.</DT ><DT ><A HREF="sdlsetgamma.html" >SDL_SetGamma</A > -- Sets the color gamma function for the display</DT ><DT ><A HREF="sdlgetgammaramp.html" >SDL_GetGammaRamp</A > -- Gets the color gamma lookup tables for the display</DT ><DT ><A HREF="sdlsetgammaramp.html" >SDL_SetGammaRamp</A > -- Sets the color gamma lookup tables for the display</DT ><DT ><A HREF="sdlmaprgb.html" >SDL_MapRGB</A > -- Map a RGB color value to a pixel format.</DT ><DT ><A HREF="sdlmaprgba.html" >SDL_MapRGBA</A > -- Map a RGBA color value to a pixel format.</DT ><DT ><A HREF="sdlgetrgb.html" >SDL_GetRGB</A > -- Get RGB values from a pixel in the specified pixel format.</DT ><DT ><A HREF="sdlgetrgba.html" >SDL_GetRGBA</A > -- Get RGBA values from a pixel in the specified pixel format.</DT ><DT ><A HREF="sdlcreatergbsurface.html" >SDL_CreateRGBSurface</A > -- Create an empty SDL_Surface</DT ><DT ><A HREF="sdlcreatergbsurfacefrom.html" >SDL_CreateRGBSurfaceFrom</A > -- Create an SDL_Surface from pixel data</DT ><DT ><A HREF="sdlfreesurface.html" >SDL_FreeSurface</A > -- Frees (deletes) a SDL_Surface</DT ><DT ><A HREF="sdllocksurface.html" >SDL_LockSurface</A > -- Lock a surface for directly access.</DT ><DT ><A HREF="sdlunlocksurface.html" >SDL_UnlockSurface</A > -- Unlocks a previously locked surface.</DT ><DT ><A HREF="sdlloadbmp.html" >SDL_LoadBMP</A > -- Load a Windows BMP file into an SDL_Surface.</DT ><DT ><A HREF="sdlsavebmp.html" >SDL_SaveBMP</A > -- Save an SDL_Surface as a Windows BMP file.</DT ><DT ><A HREF="sdlsetcolorkey.html" >SDL_SetColorKey</A > -- Sets the color key (transparent pixel) in a blittable surface and RLE acceleration.</DT ><DT ><A HREF="sdlsetalpha.html" >SDL_SetAlpha</A > -- Adjust the alpha properties of a surface</DT ><DT ><A HREF="sdlsetcliprect.html" >SDL_SetClipRect</A > -- Sets the clipping rectangle for a surface.</DT ><DT ><A HREF="sdlgetcliprect.html" >SDL_GetClipRect</A > -- Gets the clipping rectangle for a surface.</DT ><DT ><A HREF="sdlconvertsurface.html" >SDL_ConvertSurface</A > -- Converts a surface to the same format as another surface.</DT ><DT ><A HREF="sdlblitsurface.html" >SDL_BlitSurface</A > -- This performs a fast blit from the source surface to the destination surface.</DT ><DT ><A HREF="sdlfillrect.html" >SDL_FillRect</A > -- This function performs a fast fill of the given rectangle with some color</DT ><DT ><A HREF="sdldisplayformat.html" >SDL_DisplayFormat</A > -- Convert a surface to the display format</DT ><DT ><A HREF="sdldisplayformatalpha.html" >SDL_DisplayFormatAlpha</A > -- Convert a surface to the display format</DT ><DT ><A HREF="sdlwarpmouse.html" >SDL_WarpMouse</A > -- Set the position of the mouse cursor.</DT ><DT ><A HREF="sdlcreatecursor.html" >SDL_CreateCursor</A > -- Creates a new mouse cursor.</DT ><DT ><A HREF="sdlfreecursor.html" >SDL_FreeCursor</A > -- Frees a cursor created with SDL_CreateCursor.</DT ><DT ><A HREF="sdlsetcursor.html" >SDL_SetCursor</A > -- Set the currently active mouse cursor.</DT ><DT ><A HREF="sdlgetcursor.html" >SDL_GetCursor</A > -- Get the currently active mouse cursor.</DT ><DT ><A HREF="sdlshowcursor.html" >SDL_ShowCursor</A > -- Toggle whether or not the cursor is shown on the screen.</DT ><DT ><A HREF="sdlglloadlibrary.html" >SDL_GL_LoadLibrary</A > -- Specify an OpenGL library</DT ><DT ><A HREF="sdlglgetprocaddress.html" >SDL_GL_GetProcAddress</A > -- Get the address of a GL function</DT ><DT ><A HREF="sdlglgetattribute.html" >SDL_GL_GetAttribute</A > -- Get the value of a special SDL/OpenGL attribute</DT ><DT ><A HREF="sdlglsetattribute.html" >SDL_GL_SetAttribute</A > -- Set a special SDL/OpenGL attribute</DT ><DT ><A HREF="sdlglswapbuffers.html" >SDL_GL_SwapBuffers</A > -- Swap OpenGL framebuffers/Update Display</DT ><DT ><A HREF="sdlcreateyuvoverlay.html" >SDL_CreateYUVOverlay</A > -- Create a YUV video overlay</DT ><DT ><A HREF="sdllockyuvoverlay.html" >SDL_LockYUVOverlay</A > -- Lock an overlay</DT ><DT ><A HREF="sdlunlockyuvoverlay.html" >SDL_UnlockYUVOverlay</A > -- Unlock an overlay</DT ><DT ><A HREF="sdldisplayyuvoverlay.html" >SDL_DisplayYUVOverlay</A > -- Blit the overlay to the display</DT ><DT ><A HREF="sdlfreeyuvoverlay.html" >SDL_FreeYUVOverlay</A > -- Free a YUV video overlay</DT ><DT ><A HREF="sdlglattr.html" >SDL_GLattr</A > -- SDL GL Attributes</DT ><DT ><A HREF="sdlrect.html" >SDL_Rect</A > -- Defines a rectangular area</DT ><DT ><A HREF="sdlcolor.html" >SDL_Color</A > -- Format independent color description</DT ><DT ><A HREF="sdlpalette.html" >SDL_Palette</A > -- Color palette for 8-bit pixel formats</DT ><DT ><A HREF="sdlpixelformat.html" >SDL_PixelFormat</A > -- Stores surface format information</DT ><DT ><A HREF="sdlsurface.html" >SDL_Surface</A > -- Graphical Surface Structure</DT ><DT ><A HREF="sdlvideoinfo.html" >SDL_VideoInfo</A > -- Video Target information</DT ><DT ><A HREF="sdloverlay.html" >SDL_Overlay</A > -- YUV video overlay</DT ></DL ></DD ><DT >7. <A HREF="wm.html" >Window Management</A ></DT ><DD ><DL ><DT ><A HREF="sdlwmsetcaption.html" >SDL_WM_SetCaption</A > -- Sets the window tile and icon name.</DT ><DT ><A HREF="sdlwmgetcaption.html" >SDL_WM_GetCaption</A > -- Gets the window title and icon name.</DT ><DT ><A HREF="sdlwmseticon.html" >SDL_WM_SetIcon</A > -- Sets the icon for the display window.</DT ><DT ><A HREF="sdlwmiconifywindow.html" >SDL_WM_IconifyWindow</A > -- Iconify/Minimise the window</DT ><DT ><A HREF="sdlwmtogglefullscreen.html" >SDL_WM_ToggleFullScreen</A > -- Toggles fullscreen mode</DT ><DT ><A HREF="sdlwmgrabinput.html" >SDL_WM_GrabInput</A > -- Grabs mouse and keyboard input.</DT ></DL ></DD ><DT >8. <A HREF="event.html" >Events</A ></DT ><DD ><DL ><DT ><A HREF="event.html#AEN3691" >Introduction</A ></DT ><DT ><A HREF="eventstructures.html" >SDL Event Structures.</A ></DT ><DT ><A HREF="eventfunctions.html" >Event Functions.</A ></DT ></DL ></DD ><DT >9. <A HREF="joystick.html" >Joystick</A ></DT ><DD ><DL ><DT ><A HREF="sdlnumjoysticks.html" >SDL_NumJoysticks</A > -- Count available joysticks.</DT ><DT ><A HREF="sdljoystickname.html" >SDL_JoystickName</A > -- Get joystick name.</DT ><DT ><A HREF="sdljoystickopen.html" >SDL_JoystickOpen</A > -- Opens a joystick for use.</DT ><DT ><A HREF="sdljoystickopened.html" >SDL_JoystickOpened</A > -- Determine if a joystick has been opened</DT ><DT ><A HREF="sdljoystickindex.html" >SDL_JoystickIndex</A > -- Get the index of an SDL_Joystick.</DT ><DT ><A HREF="sdljoysticknumaxes.html" >SDL_JoystickNumAxes</A > -- Get the number of joystick axes</DT ><DT ><A HREF="sdljoysticknumballs.html" >SDL_JoystickNumBalls</A > -- Get the number of joystick trackballs</DT ><DT ><A HREF="sdljoysticknumhats.html" >SDL_JoystickNumHats</A > -- Get the number of joystick hats</DT ><DT ><A HREF="sdljoysticknumbuttons.html" >SDL_JoystickNumButtons</A > -- Get the number of joysitck buttons</DT ><DT ><A HREF="sdljoystickupdate.html" >SDL_JoystickUpdate</A > -- Updates the state of all joysticks</DT ><DT ><A HREF="sdljoystickgetaxis.html" >SDL_JoystickGetAxis</A > -- Get the current state of an axis</DT ><DT ><A HREF="sdljoystickgethat.html" >SDL_JoystickGetHat</A > -- Get the current state of a joystick hat</DT ><DT ><A HREF="sdljoystickgetbutton.html" >SDL_JoystickGetButton</A > -- Get the current state of a given button on a given joystick</DT ><DT ><A HREF="sdljoystickgetball.html" >SDL_JoystickGetBall</A > -- Get relative trackball motion</DT ><DT ><A HREF="sdljoystickclose.html" >SDL_JoystickClose</A > -- Closes a previously opened joystick</DT ></DL ></DD ><DT >10. <A HREF="audio.html" >Audio</A ></DT ><DD ><DL ><DT ><A HREF="sdlaudiospec.html" >SDL_AudioSpec</A > -- Audio Specification Structure</DT ><DT ><A HREF="sdlopenaudio.html" >SDL_OpenAudio</A > -- Opens the audio device with the desired parameters.</DT ><DT ><A HREF="sdlpauseaudio.html" >SDL_PauseAudio</A > -- Pauses and unpauses the audio callback processing</DT ><DT ><A HREF="sdlgetaudiostatus.html" >SDL_GetAudioStatus</A > -- Get the current audio state</DT ><DT ><A HREF="sdlloadwav.html" >SDL_LoadWAV</A > -- Load a WAVE file</DT ><DT ><A HREF="sdlfreewav.html" >SDL_FreeWAV</A > -- Frees previously opened WAV data</DT ><DT ><A HREF="sdlaudiocvt.html" >SDL_AudioCVT</A > -- Audio Conversion Structure</DT ><DT ><A HREF="sdlbuildaudiocvt.html" >SDL_BuildAudioCVT</A > -- Initializes a SDL_AudioCVT structure for conversion</DT ><DT ><A HREF="sdlconvertaudio.html" >SDL_ConvertAudio</A > -- Convert audio data to a desired audio format.</DT ><DT ><A HREF="sdlmixaudio.html" >SDL_MixAudio</A > -- Mix audio data</DT ><DT ><A HREF="sdllockaudio.html" >SDL_LockAudio</A > -- Lock out the callback function</DT ><DT ><A HREF="sdlunlockaudio.html" >SDL_UnlockAudio</A > -- Unlock the callback function</DT ><DT ><A HREF="sdlcloseaudio.html" >SDL_CloseAudio</A > -- Shuts down audio processing and closes the audio device.</DT ></DL ></DD ><DT >11. <A HREF="cdrom.html" >CD-ROM</A ></DT ><DD ><DL ><DT ><A HREF="sdlcdnumdrives.html" >SDL_CDNumDrives</A > -- Returns the number of CD-ROM drives on the system.</DT ><DT ><A HREF="sdlcdname.html" >SDL_CDName</A > -- Returns a human-readable, system-dependent identifier for the CD-ROM.</DT ><DT ><A HREF="sdlcdopen.html" >SDL_CDOpen</A > -- Opens a CD-ROM drive for access.</DT ><DT ><A HREF="sdlcdstatus.html" >SDL_CDStatus</A > -- Returns the current status of the given drive.</DT ><DT ><A HREF="sdlcdplay.html" >SDL_CDPlay</A > -- Play a CD</DT ><DT ><A HREF="sdlcdplaytracks.html" >SDL_CDPlayTracks</A > -- Play the given CD track(s)</DT ><DT ><A HREF="sdlcdpause.html" >SDL_CDPause</A > -- Pauses a CDROM</DT ><DT ><A HREF="sdlcdresume.html" >SDL_CDResume</A > -- Resumes a CDROM</DT ><DT ><A HREF="sdlcdstop.html" >SDL_CDStop</A > -- Stops a CDROM</DT ><DT ><A HREF="sdlcdeject.html" >SDL_CDEject</A > -- Ejects a CDROM</DT ><DT ><A HREF="sdlcdclose.html" >SDL_CDClose</A > -- Closes a SDL_CD handle</DT ><DT ><A HREF="sdlcd.html" >SDL_CD</A > -- CDROM Drive Information</DT ><DT ><A HREF="sdlcdtrack.html" >SDL_CDtrack</A > -- CD Track Information Structure</DT ></DL ></DD ><DT >12. <A HREF="thread.html" >Multi-threaded Programming</A ></DT ><DD ><DL ><DT ><A HREF="sdlcreatethread.html" >SDL_CreateThread</A > -- Creates a new thread of execution that shares its parent's properties.</DT ><DT ><A HREF="sdlthreadid.html" >SDL_ThreadID</A > -- Get the 32-bit thread identifier for the current thread.</DT ><DT ><A HREF="sdlgetthreadid.html" >SDL_GetThreadID</A > -- Get the SDL thread ID of a SDL_Thread</DT ><DT ><A HREF="sdlwaitthread.html" >SDL_WaitThread</A > -- Wait for a thread to finish.</DT ><DT ><A HREF="sdlkillthread.html" >SDL_KillThread</A > -- Gracelessly terminates the thread.</DT ><DT ><A HREF="sdlcreatemutex.html" >SDL_CreateMutex</A > -- Create a mutex</DT ><DT ><A HREF="sdldestroymutex.html" >SDL_DestroyMutex</A > -- Destroy a mutex</DT ><DT ><A HREF="sdlmutexp.html" >SDL_mutexP</A > -- Lock a mutex</DT ><DT ><A HREF="sdlmutexv.html" >SDL_mutexV</A > -- Unlock a mutex</DT ><DT ><A HREF="sdlcreatesemaphore.html" >SDL_CreateSemaphore</A > -- Creates a new semaphore and assigns an initial value to it.</DT ><DT ><A HREF="sdldestroysemaphore.html" >SDL_DestroySemaphore</A > -- Destroys a semaphore that was created by <A HREF="sdlcreatesemaphore.html" >SDL_CreateSemaphore</A >.</DT ><DT ><A HREF="sdlsemwait.html" >SDL_SemWait</A > -- Lock a semaphore and suspend the thread if the semaphore value is zero.</DT ><DT ><A HREF="sdlsemtrywait.html" >SDL_SemTryWait</A > -- Attempt to lock a semaphore but don't suspend the thread.</DT ><DT ><A HREF="sdlsemwaittimeout.html" >SDL_SemWaitTimeout</A > -- Lock a semaphore, but only wait up to a specified maximum time.</DT ><DT ><A HREF="sdlsempost.html" >SDL_SemPost</A > -- Unlock a semaphore.</DT ><DT ><A HREF="sdlsemvalue.html" >SDL_SemValue</A > -- Return the current value of a semaphore.</DT ><DT ><A HREF="sdlcreatecond.html" >SDL_CreateCond</A > -- Create a condition variable</DT ><DT ><A HREF="sdldestroycond.html" >SDL_DestroyCond</A > -- Destroy a condition variable</DT ><DT ><A HREF="sdlcondsignal.html" >SDL_CondSignal</A > -- Restart a thread wait on a condition variable</DT ><DT ><A HREF="sdlcondbroadcast.html" >SDL_CondBroadcast</A > -- Restart all threads waiting on a condition variable</DT ><DT ><A HREF="sdlcondwait.html" >SDL_CondWait</A > -- Wait on a condition variable</DT ><DT ><A HREF="sdlcondwaittimeout.html" >SDL_CondWaitTimeout</A > -- Wait on a condition variable, with timeout</DT ></DL ></DD ><DT >13. <A HREF="time.html" >Time</A ></DT ><DD ><DL ><DT ><A HREF="sdlgetticks.html" >SDL_GetTicks</A > -- Get the number of milliseconds since the SDL library initialization.</DT ><DT ><A HREF="sdldelay.html" >SDL_Delay</A > -- Wait a specified number of milliseconds before returning.</DT ><DT ><A HREF="sdladdtimer.html" >SDL_AddTimer</A > -- Add a timer which will call a callback after the specified number of milliseconds has elapsed.</DT ><DT ><A HREF="sdlremovetimer.html" >SDL_RemoveTimer</A > -- Remove a timer which was added with <A HREF="sdladdtimer.html" >SDL_AddTimer</A >.</DT ><DT ><A HREF="sdlsettimer.html" >SDL_SetTimer</A > -- Set a callback to run after the specified number of milliseconds has elapsed.</DT ></DL ></DD ></DL ></DD ></DL ></DIV ><DIV CLASS="LOT" ><DL CLASS="LOT" ><DT ><B >List of Tables</B ></DT ><DT >8-1. <A HREF="sdlkey.html#AEN4720" >SDL Keysym definitions</A ></DT ><DT >8-2. <A HREF="sdlkey.html#SDLMOD" >SDL modifier definitions</A ></DT ></DL ></DIV ><DIV CLASS="LOT" ><DL CLASS="LOT" ><DT ><B >List of Examples</B ></DT ><DT >1-1. <A HREF="guidebasicsinit.html#AEN60" >Initializing SDL</A ></DT ><DT >2-1. <A HREF="guidevideo.html#AEN71" >Initializing the Video Display</A ></DT ><DT >2-2. <A HREF="guidevideo.html#AEN77" >Initializing the Best Video Mode</A ></DT ><DT >2-3. <A HREF="guidevideo.html#AEN83" >Loading and Displaying a BMP File</A ></DT ><DT >2-4. <A HREF="guidevideo.html#AEN90" >getpixel()</A ></DT ><DT >2-5. <A HREF="guidevideo.html#AEN93" >putpixel()</A ></DT ><DT >2-6. <A HREF="guidevideo.html#AEN97" >Using putpixel()</A ></DT ><DT >2-7. <A HREF="guidevideoopengl.html#AEN114" >Initializing SDL with OpenGL</A ></DT ><DT >2-8. <A HREF="guidevideoopengl.html#AEN128" >SDL and OpenGL</A ></DT ><DT >3-1. <A HREF="guideinput.html#AEN141" >Initializing SDL with Joystick Support</A ></DT ><DT >3-2. <A HREF="guideinput.html#AEN154" >Querying the Number of Available Joysticks</A ></DT ><DT >3-3. <A HREF="guideinput.html#AEN183" >Opening a Joystick</A ></DT ><DT >3-4. <A HREF="guideinput.html#AEN191" >Joystick Axis Events</A ></DT ><DT >3-5. <A HREF="guideinput.html#AEN195" >More Joystick Axis Events</A ></DT ><DT >3-6. <A HREF="guideinput.html#AEN203" >Joystick Button Events</A ></DT ><DT >3-7. <A HREF="guideinput.html#AEN217" >Joystick Ball Events</A ></DT ><DT >3-8. <A HREF="guideinput.html#AEN244" >Joystick Hat Events</A ></DT ><DT >3-9. <A HREF="guideinput.html#AEN265" >Querying Joystick Characteristics</A ></DT ><DT >3-10. <A HREF="guideinputkeyboard.html#AEN334" >Reading Keyboard Events</A ></DT ><DT >3-11. <A HREF="guideinputkeyboard.html#AEN351" >Interpreting Key Event Information</A ></DT ><DT >3-12. <A HREF="guideinputkeyboard.html#AEN363" >Proper Game Movement</A ></DT ></DL ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" > </TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="guide.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" > </TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >SDL Guide</TD ></TR ></TABLE ></DIV ></BODY ></HTML >