[Prev] Table Of Contents [Next]

What can it do?

Video
  • Set a video mode at any depth (8-bpp or greater) with optional conversion, if the video mode is not supported by the hardware.
  • Write directly to a linear graphics framebuffer.
  • Create surfaces with colorkey or alpha blending attributes.
  • Surface blits are automatically converted to the target format using optimized blitters and are hardware accelerated, when possible. MMX optimized blits are available for the x86.
  • Hardware accelerated blit and fill operations are used if supported by the hardware.
Tip:
You can set your application's title-bar (if any) and icon using the SDL_WM_SetCaption() and SDL_WM_SetIcon() functions respectively.
Events
  • Events provided for:
    • Application visibility changes
    • Keyboard input
    • Mouse input
    • User-requested quit
  • Each event can be enabled or disabled with SDL_EventState().
  • Events are passed through a user-specified filter function before being posted to the internal event queue.
  • Thread-safe event queue.
Tip:
Use SDL_PeepEvents() to search for an event of a particular type in the event queue.
Audio
  • Set audio playback of 8-bit and 16-bit audio, mono or stereo, with optional conversion if the format is not supported by the hardware.
  • Audio runs independently in a separate thread, filled via a user callback mechanism.
  • Designed for custom software audio mixers, but the example archive contains a complete audio/music output library.
Tip:
Use the SDL_LockAudio() and SDL_UnlockAudio() functions to synchronize access data shared by the audio callback and the rest of the program.
CD-ROM audio
  • Complete CD audio control API
Tip:
If you pass a NULL CD-ROM handle to the CD-ROM API functions, they will act on the last CD-ROM that was opened.
Threads
  • Simple thread creation API
  • Simple binary semaphores for synchronization
Tip:
Do not use C library functions like I/O and memory management from threads if you can help it - they lock resources used by other threads.
Timers
  • Get the number of milliseconds elapsed
  • Wait a specified number of milliseconds
  • Set a single periodic timer with 10ms resolution
Tip:
You can easily replace the Win32 GetTickCount() with SDL_GetTicks()
Endian independence
  • Detect the endianness of the current system
  • Routines for fast swapping of data values
  • Read and write data of a specified endianness
Tip:
When reading your data files, you may need to byteswap 16-bit graphics

[Prev] Table Of Contents [Next]