2 This is a list of API changes in SDL's version history.
7 Added SDL_HasMMX(), SDL_Has3DNow(), SDL_HasSSE()
10 Added SDL_LoadObject(), SDL_LoadFunction(), and SDL_UnloadObject()
12 Added SDL_GL_MULTISAMPLEBUFFERS and SDL_GL_MULTISAMPLESAMPLES for FSAA
15 Added SDL_BUTTON_WHEELUP (4) and SDL_BUTTON_WHEELDOWN (5)
17 Added SDL_GL_STEREO for stereoscopic OpenGL contexts
20 Added SDL_VIDEOEXPOSE event to signal that the screen needs to
21 be redrawn. This is currently only delivered to OpenGL windows
22 on X11, though it may be delivered in the future when the video
23 memory is lost under DirectX.
26 You can pass SDL_NOFRAME to SDL_VideoMode() to create a window
27 that has no title bar or frame decoration. Fullscreen video
28 modes automatically have this flag set.
30 Added a function to query the clipping rectangle for a surface:
31 void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect)
33 Added a function to query the current event filter:
34 SDL_EventFilter SDL_GetEventFilter(void)
36 If you pass -1 to SDL_ShowCursor(), it won't change the current
37 cursor visibility state, but will still return it.
39 SDL_LockSurface() and SDL_UnlockSurface() are recursive, meaning
40 you can nest them as deep as you want, as long as each lock call
41 has a matching unlock call. The surface remains locked until the
42 last matching unlock call.
44 Note that you may not blit to or from a locked surface.
47 The SDL_SetGammaRamp() and SDL_GetGammaRamp() functions now take
48 arrays of Uint16 values instead of Uint8 values. For the most part,
49 you can just take your old values and shift them up 8 bits to get
50 new correct values for your gamma ramps.
52 You can pass SDL_RLEACCEL in flags passed to SDL_ConvertSurface()
53 and SDL will try to RLE accelerate colorkey and alpha blits in the
57 Added a function to return the thread ID of a specific thread:
58 Uint32 SDL_GetThreadID(SDL_Thread *thread)
59 If 'thread' is NULL, this function returns the id for this thread.
62 The YUV overlay structure has been changed to use an array of
63 pitches and pixels representing the planes of a YUV image, to
64 better enable hardware acceleration. The YV12 and IYUV formats
65 each have three planes, corresponding to the Y, U, and V portions
66 of the image, while packed pixel YUV formats just have one plane.
68 For palettized mode (8bpp), the screen colormap is now split in
69 a physical and a logical palette. The physical palette determines
70 what colours the screen pixels will get when displayed, and the
71 logical palette controls the mapping from blits to/from the screen.
72 A new function, SDL_SetPalette() has been added to change
73 logical and physical palettes separately. SDL_SetColors() works
74 just as before, and is equivalent to calling SDL_SetPalette() with
75 a flag argument of (SDL_LOGPAL|SDL_PHYSPAL).
77 SDL_BlitSurface() no longer modifies the source rectangle, only the
78 destination rectangle. The width/height members of the destination
79 rectangle are ignored, only the position is used.
81 The old source clipping function SDL_SetClipping() has been replaced
82 with a more useful function to set the destination clipping rectangle:
83 SDL_bool SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect)
85 Added a function to see what subsystems have been initialized:
86 Uint32 SDL_WasInit(Uint32 flags)
88 The Big Alpha Flip: SDL now treats alpha as opacity like everybody
89 else, and not as transparency:
91 A new cpp symbol: SDL_ALPHA_OPAQUE is defined as 255
92 A new cpp symbol: SDL_ALPHA_TRANSPARENT is defined as 0
93 Values between 0 and 255 vary from fully transparent to fully opaque.
96 SDL_DisplayFormatAlpha()
97 Returns a surface converted to a format with alpha-channel
98 that can be blit efficiently to the screen. (In other words,
99 like SDL_DisplayFormat() but the resulting surface has
100 an alpha channel.) This is useful for surfaces with alpha.
102 Works as SDL_MapRGB() but takes an additional alpha parameter.
104 Works as SDL_GetRGB() but also returns the alpha value
105 (SDL_ALPHA_OPAQUE for formats without an alpha channel)
107 Both SDL_GetRGB() and SDL_GetRGBA() now always return values in
108 the [0..255] interval. Previously, SDL_GetRGB() would return
109 (0xf8, 0xfc, 0xf8) for a completely white pixel in RGB565 format.
110 (N.B.: This is broken for bit fields < 3 bits.)
112 SDL_MapRGB() returns pixels in which the alpha channel is set opaque.
114 SDL_SetAlpha() can now be used for both setting the per-surface
115 alpha, using the new way of thinking of alpha, and also to enable
116 and disable per-pixel alpha blending for surfaces with an alpha
118 To disable alpha blending:
119 SDL_SetAlpha(surface, 0, 0);
120 To re-enable alpha blending:
121 SDL_SetAlpha(surface, SDL_SRCALPHA, 0);
122 Surfaces with an alpha channel have blending enabled by default.
124 SDL_SetAlpha() now accepts SDL_RLEACCEL as a flag, which requests
125 RLE acceleration of blits, just as like with SDL_SetColorKey().
126 This flag can be set for both surfaces with an alpha channel
127 and surfaces with an alpha value set by SDL_SetAlpha().
128 As always, RLE surfaces must be locked before pixel access is
129 allowed, and unlocked before any other SDL operations are done
132 The blit semantics for surfaces with and without alpha and colorkey
133 have now been defined:
137 alpha-blend (using alpha-channel).
138 SDL_SRCCOLORKEY ignored.
139 SDL_SRCALPHA not set:
141 if SDL_SRCCOLORKEY set, only copy the pixels matching the
142 RGB values of the source colour key, ignoring alpha in the
147 alpha-blend (using the source per-surface alpha value);
148 set destination alpha to opaque.
149 SDL_SRCALPHA not set:
150 copy RGB, set destination alpha to opaque.
152 if SDL_SRCCOLORKEY set, only copy the pixels matching the
157 alpha-blend (using the source alpha channel) the RGB values;
158 leave destination alpha untouched. [Note: is this correct?]
159 SDL_SRCCOLORKEY ignored.
160 SDL_SRCALPHA not set:
161 copy all of RGBA to the destination.
162 if SDL_SRCCOLORKEY set, only copy the pixels matching the
163 RGB values of the source colour key, ignoring alpha in the
168 alpha-blend (using the source per-surface alpha value).
169 SDL_SRCALPHA not set:
172 if SDL_SRCCOLORKEY set, only copy the pixels matching the
175 As a special case, blits from surfaces with per-surface alpha
176 value of 128 (50% transparency) are optimised and much faster
177 than other alpha values. This does not apply to surfaces with
178 alpha channels (per-pixel alpha).
180 New functions for manipulating the gamma of the display have
182 int SDL_SetGamma(float red, float green, float blue);
183 int SDL_SetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue);
184 int SDL_GetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue);
185 Gamma ramps are tables with 256 entries which map the screen color
186 components into actually displayed colors. For an example of
187 implementing gamma correction and gamma fades, see test/testgamma.c
188 Gamma control is not supported on all hardware.
191 The size of the SDL_CDtrack structure changed from 8 to 12 bytes
192 as the size of the length member was extended to 32 bits.
194 You can now use SDL for 2D blitting with a GL mode by passing the
195 SDL_OPENGLBLIT flag to SDL_SetVideoMode(). You can specify 16 or
196 32 bpp, and the data in the framebuffer is put into the GL scene
197 when you call SDL_UpdateRects(), and the scene will be visible
198 when you call SDL_GL_SwapBuffers().
200 Run the "testgl" test program with the -logo command line option
201 to see an example of this blending of 2D and 3D in SDL.
204 Added SDL_FreeRW() to the API, to complement SDL_AllocRW()
206 Added resizable window support - just add SDL_RESIZABLE to the
207 SDL_SetVideoMode() flags, and then wait for SDL_VIDEORESIZE events.
208 See SDL_events.h for details on the new SDL_ResizeEvent structure.
210 Added condition variable support, based on mutexes and semaphores.
217 The new function prototypes are in SDL_mutex.h
219 Added counting semaphore support, based on the mutex primitive.
220 SDL_CreateSemaphore()
221 SDL_DestroySemaphore()
227 The new function prototypes are in SDL_mutex.h
229 Added support for asynchronous blitting. To take advantage of this,
230 you must set the SDL_ASYNCBLIT flag when setting the video mode and
231 creating surfaces that you want accelerated in this way. You must
232 lock surfaces that have this flag set, and the lock will block until
233 any queued blits have completed.
235 Added YUV video overlay support.
236 The supported YUV formats are: YV12, IYUV, YUY2, UYVY, and YVYU.
237 This function creates an overlay surface:
238 SDL_CreateYUVOverlay()
239 You must lock and unlock the overlay to get access to the data:
240 SDL_LockYUVOverlay() SDL_UnlockYUVOverlay()
241 You can then display the overlay:
242 SDL_DisplayYUVOverlay()
243 You must free the overlay when you are done using it:
245 See SDL_video.h for the full function prototypes.
247 The joystick hat position constants have been changed:
248 Old constant New constant
249 ------------ ------------
259 The new constants are bitmasks, so you can check for the
260 individual axes like this:
261 if ( hat_position & SDL_HAT_UP ) {
263 and you'll catch left-up, up, and right-up.
266 Added multiple timer support:
267 SDL_AddTimer() and SDL_RemoveTimer()
269 SDL_WM_SetIcon() now respects the icon colorkey if mask is NULL.
272 Added initial OpenGL support.
273 First set GL attributes (such as RGB depth, alpha depth, etc.)
274 SDL_GL_SetAttribute()
275 Then call SDL_SetVideoMode() with the SDL_OPENGL flag.
276 Perform all of your normal GL drawing.
277 Finally swap the buffers with the new SDL function:
279 See the new 'testgl' test program for an example of using GL with SDL.
281 You can load GL extension functions by using the function:
282 SDL_GL_LoadProcAddress()
284 Added functions to initialize and cleanup specific SDL subsystems:
285 SDL_InitSubSystem() and SDL_QuitSubSystem()
287 Added user-defined event type:
294 This structure is in the "user" member of an SDL_Event.
296 Added a function to push events into the event queue:
299 Example of using the new SDL user-defined events:
303 event.type = SDL_USEREVENT;
304 event.user.code = my_event_code;
305 event.user.data1 = significant_data;
306 event.user.data2 = 0;
307 SDL_PushEvent(&event);
310 Added a function to get mouse deltas since last query:
311 SDL_GetRelativeMouseState()
313 Added a boolean datatype to SDL_types.h:
314 SDL_bool = { SDL_TRUE, SDL_FALSE }
316 Added a function to get the current audio status:
323 Added an AAlib driver (ASCII Art) - by Stephane Peter.
326 The input grab state is reset after each call to SDL_SetVideoMode().
327 The input is grabbed by default in fullscreen mode, and ungrabbed in
328 windowed mode. If you want to set input grab to a particular value,
329 you should set it after each call to SDL_SetVideoMode().
332 Exposed SDL_AudioInit(), SDL_VideoInit()
333 Added SDL_AudioDriverName() and SDL_VideoDriverName()
335 Added new window manager function:
336 SDL_WM_ToggleFullScreen()
337 This is currently implemented only on Linux
339 The ALT-ENTER code has been removed - it's not appropriate for a
340 lib to bind keys when they aren't even emergency escape sequences.
342 ALT-ENTER functionality can be implemented with the following code:
344 int Handle_AltEnter(const SDL_Event *event)
346 if ( event->type == SDL_KEYDOWN ) {
347 if ( (event->key.keysym.sym == SDLK_RETURN) &&
348 (event->key.keysym.mod & KMOD_ALT) ) {
349 SDL_WM_ToggleFullScreen(SDL_GetVideoSurface());
355 SDL_SetEventFilter(Handle_AltEnter);
358 Under X11, if you grab the input and hide the mouse cursor,
359 the mouse will go into a "relative motion" mode where you
360 will always get relative motion events no matter how far in
361 each direction you move the mouse - relative motion is not
362 bounded by the edges of the window (though the absolute values
363 of the mouse positions are clamped by the size of the window).
364 The SVGAlib, framebuffer console, and DirectInput drivers all
365 have this behavior naturally, and the GDI and BWindow drivers
366 never go into "relative motion" mode.
369 Added a function to enable keyboard repeat:
370 SDL_EnableKeyRepeat()
372 Added a function to grab the mouse and keyboard input
375 Added a function to iconify the window.
376 SDL_WM_IconifyWindow()
377 If this function succeeds, the application will receive an event
378 signaling SDL_APPACTIVE event
381 Added constants to SDL_audio.h for 16-bit native byte ordering:
382 AUDIO_U16SYS, AUDIO_S16SYS
390 A new function SDL_GetVideoSurface() has been added, and returns
391 a pointer to the current display surface.
393 SDL_AllocSurface() has been renamed SDL_CreateRGBSurface(), and
394 a new function SDL_CreateRGBSurfaceFrom() has been added to allow
395 creating an SDL surface from an existing pixel data buffer.
397 Added SDL_GetRGB() to the headers and documentation.
400 SDL_SetLibraryPath() is no longer meaningful, and has been removed.
403 A new flag for SDL_Init(), SDL_INIT_NOPARACHUTE, prevents SDL from
404 installing fatal signal handlers on operating systems that support
410 SDL_CreateColorCursor() has been removed. Color cursors should
411 be implemented as sprites, blitted by the application when the
412 cursor moves. To get smooth color cursor updates when the app
413 is busy, pass the SDL_INIT_EVENTTHREAD flag to SDL_Init(). This
414 allows you to handle the mouse motion in another thread from an
415 event filter function, but is currently only supported by Linux
416 and BeOS. Note that you'll have to protect the display surface
417 from multi-threaded access by using mutexes if you do this.
419 Thread-safe surface support has been removed from SDL.
420 This makes blitting somewhat faster, by removing SDL_MiddleBlit().
421 Code that used SDL_MiddleBlit() should use SDL_LowerBlit() instead.
422 You can make your surfaces thread-safe by allocating your own
423 mutex and making lock/unlock calls around accesses to your surface.
426 SDL_GetMouseState() now takes pointers to int rather than Uint16.
428 If you set the SDL_WINDOWID environment variable under UNIX X11,
429 SDL will use that as the main window instead of creating it's own.
430 This is an unsupported extension to SDL, and not portable at all.
433 Added a function SDL_SetLibraryPath() which can be used to specify
434 the directory containing the SDL dynamic libraries. This is useful
435 for commercial applications which ship with particular versions
436 of the libraries, and for security on multi-user systems.
437 If this function is not used, the default system directories are
438 searched using the native dynamic object loading mechanism.
440 In order to support C linkage under Visual C++, you must declare
441 main() without any return type:
442 main(int argc, char *argv[]) {
443 /* Do the program... */
446 C++ programs should also return a value if compiled under VC++.
448 The blit_endian member of the SDL_VideoInfo struct has been removed.
450 SDL_SymToASCII() has been replaced with SDL_GetKeyName(), so there
451 is now no longer any function to translate a keysym to a character.
453 The SDL_keysym structure has been extended with a 'scancode' and
454 'unicode' member. The 'scancode' is a hardware specific scancode
455 for the key that was pressed, and may be 0. The 'unicode' member
456 is a 16-bit UNICODE translation of the key that was pressed along
457 with any modifiers or compose keys that have been pressed.
458 If no UNICODE translation exists for the key, 'unicode' will be 0.
460 Added a function SDL_EnableUNICODE() to enable/disable UNICODE
461 translation of character keypresses. Translation defaults off.
463 To convert existing code to use the new API, change code which
464 uses SDL_SymToASCII() to get the keyname to use SDL_GetKeyName(),
465 and change code which uses it to get the ASCII value of a sym to
466 use the 'unicode' member of the event keysym.
469 There is partial support for 64-bit datatypes. I don't recommend
470 you use this if you have a choice, because 64-bit datatypes are not
471 supported on many platforms. On platforms for which it is supported,
472 the SDL_HAS_64BIT_TYPE C preprocessor define will be enabled, and
473 you can use the Uint64 and Sint64 datatypes.
475 Added functions to SDL_endian.h to support 64-bit datatypes:
476 SDL_SwapLE64(), SDL_SwapBE64(),
477 SDL_ReadLE64(), SDL_ReadBE64(), SDL_WriteLE64(), SDL_WriteBE64()
479 A new member "len_ratio" has been added to the SDL_AudioCVT structure,
480 and allows you to determine either the original buffer length or the
481 converted buffer length, given the other.
483 A new function SDL_FreeWAV() has been added to the API to free data
484 allocated by SDL_LoadWAV_RW(). This is necessary under Win32 since
485 the gcc compiled DLL uses a different heap than VC++ compiled apps.
487 SDL now has initial support for international keyboards using the
489 If a particular mapping is desired, you can set the DEFAULT_KEYBOARD
490 compile-time variable, or you can set the environment variable
491 "SDL_KEYBOARD" to a string identifying the keyboard mapping you desire.
492 The valid values for these variables can be found in SDL_keyboard.c
494 Full support for German and French keyboards under X11 is implemented.
497 The THREADED_EVENTS compile-time define has been replaced with the
498 SDL_INIT_EVENTTHREAD flag. If this flag is passed to SDL_Init(),
499 SDL will create a separate thread to perform input event handling.
500 If this flag is passed to SDL_Init(), and the OS doesn't support
501 event handling in a separate thread, SDL_Init() will fail.
502 Be sure to add calls to SDL_Delay() in your main thread to allow
503 the OS to schedule your event thread, or it may starve, leading
504 to slow event delivery and/or dropped events.
505 Currently MacOS and Win32 do not support this flag, while BeOS
506 and Linux do support it. I recommend that your application only
507 use this flag if absolutely necessary.
509 The SDL thread function passed to SDL_CreateThread() now returns a
510 status. This status can be retrieved by passing a non-NULL pointer
511 as the 'status' argument to SDL_WaitThread().
513 The volume parameter to SDL_MixAudio() has been increased in range
514 from (0-8) to (0-128)
516 SDL now has a data source abstraction which can encompass a file,
517 an area of memory, or any custom object you can envision. It uses
518 these abstractions, SDL_RWops, in the endian read/write functions,
519 and the built-in WAV and BMP file loaders. This means you can load
520 WAV chunks from memory mapped files, compressed archives, network
521 pipes, or anything else that has a data read abstraction.
523 There are three built-in data source abstractions:
524 SDL_RWFromFile(), SDL_RWFromFP(), SDL_RWFromMem()
525 along with a generic data source allocation function:
527 These data sources can be used like stdio file pointers with the
528 following convenience functions:
529 SDL_RWseek(), SDL_RWread(), SDL_RWwrite(), SDL_RWclose()
530 These functions are defined in the new header file "SDL_rwops.h"
532 The endian swapping functions have been turned into macros for speed
533 and SDL_CalculateEndian() has been removed. SDL_endian.h now defines
534 SDL_BYTEORDER as either SDL_BIG_ENDIAN or SDL_LIL_ENDIAN depending on
535 the endianness of the host system.
537 The endian read/write functions now take an SDL_RWops pointer
538 instead of a stdio FILE pointer, to support the new data source
541 The SDL_*LoadWAV() functions have been replaced with a single
542 SDL_LoadWAV_RW() function that takes a SDL_RWops pointer as it's
543 first parameter, and a flag whether or not to automatically
544 free it as the second parameter. SDL_LoadWAV() is a macro for
545 backward compatibility and convenience:
546 SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...);
548 The SDL_*LoadBMP()/SDL_*SaveBMP() functions have each been replaced
549 with a single function that takes a SDL_RWops pointer as it's
550 first parameter, and a flag whether or not to automatically
551 free it as the second parameter. SDL_LoadBMP() and SDL_SaveBMP()
552 are macros for backward compatibility and convenience:
553 SDL_LoadBMP_RW(SDL_RWFromFile("sample.bmp", "rb"), 1, ...);
554 SDL_SaveBMP_RW(SDL_RWFromFile("sample.bmp", "wb"), 1, ...);
555 Note that these functions use SDL_RWseek() extensively, and should
556 not be used on pipes or other non-seekable data sources.
559 The Linux SDL_SysWMInfo and SDL_SysWMMsg structures have been
560 extended to support multiple types of display drivers, as well as
561 safe access to the X11 display when THREADED_EVENTS is enabled.
562 The new structures are documented in the SDL_syswm.h header file.
564 Thanks to John Elliott <jce@seasip.demon.co.uk>, the UK keyboard
565 should now work properly, as well as the "Windows" keys on US
568 The Linux CD-ROM code now reads the CD-ROM devices from /etc/fstab
569 instead of trying to open each block device on the system.
570 The CD must be listed in /etc/fstab as using the iso9660 filesystem.
572 On Linux, if you define THREADED_EVENTS at compile time, a separate
573 thread will be spawned to gather X events asynchronously from the
574 graphics updates. This hasn't been extensively tested, but it does
575 provide a means of handling keyboard and mouse input in a separate
576 thread from the graphics thread. (This is now enabled by default.)
578 A special access function SDL_PeepEvents() allows you to manipulate
579 the event queue in a thread-safe manner, including peeking at events,
580 removing events of a specified type, and adding new events of arbitrary
581 type to the queue (use the new 'user' member of the SDL_Event type).
583 If you use SDL_PeepEvents() to gather events, then the main graphics
584 thread needs to call SDL_PumpEvents() periodically to drive the event
585 loop and generate input events. This is not necessary if SDL has been
586 compiled with THREADED_EVENTS defined, but doesn't hurt.
588 A new function SDL_ThreadID() returns the identifier associated with
592 The AUDIO_STEREO format flag has been replaced with a new 'channels'
593 member of the SDL_AudioSpec structure. The channels are 1 for mono
594 audio, and 2 for stereo audio. In the future more channels may be
595 supported for 3D surround sound.
597 The SDL_MixAudio() function now takes an additional volume parameter,
598 which should be set to SDL_MIX_MAXVOLUME for compatibility with the
601 The CD-ROM functions which take a 'cdrom' parameter can now be
602 passed NULL, and will act on the last successfully opened CD-ROM.
605 No changes, bugfixes only.
608 No changes, bugfixes only.
611 Added a fast rectangle fill function: SDL_FillRect()
613 Addition of a useful function for getting info on the video hardware:
614 const SDL_VideoInfo *SDL_GetVideoInfo(void)
615 This function replaces SDL_GetDisplayFormat().
617 Initial support for double-buffering:
618 Use the SDL_DOUBLEBUF flag in SDL_SetVideoMode()
619 Update the screen with a new function: SDL_Flip()
621 SDL_AllocSurface() takes two new flags:
622 SDL_SRCCOLORKEY means that the surface will be used for colorkey blits
623 and if the hardware supports hardware acceleration of colorkey blits
624 between two surfaces in video memory, to place the surface in video
625 memory if possible, otherwise it will be placed in system memory.
626 SDL_SRCALPHA means that the surface will be used for alpha blits and
627 if the hardware supports hardware acceleration of alpha blits between
628 two surfaces in video memory, to place the surface in video memory
629 if possible, otherwise it will be placed in system memory.
630 SDL_HWSURFACE now means that the surface will be created with the
631 same format as the display surface, since having surfaces in video
632 memory is only useful for fast blitting to the screen, and you can't
633 blit surfaces with different surface formats in video memory.
636 You can now pass a NULL mask to SDL_WM_SetIcon(), and it will assume
637 that the icon consists of the entire image.
639 SDL_LowerBlit() is back -- but don't use it on the display surface.
640 It is exactly the same as SDL_MiddleBlit(), but doesn't check for
643 Added SDL_FPLoadBMP(), SDL_FPSaveBMP(), SDL_FPLoadWAV(), which take
644 a FILE pointer instead of a file name.
646 Added CD-ROM audio control API:
660 No changes, bugfixes only.
663 Mouse motion event now includes relative motion information:
664 Sint16 event->motion.xrel, Sint16 event->motion.yrel
666 X11 keyrepeat handling can be disabled by defining IGNORE_X_KEYREPEAT
667 (Add -DIGNORE_X_KEYREPEAT to CFLAGS line in obj/x11Makefile)
670 No changes, bugfixes only.
673 Removed SDL_MapSurface() and SDL_UnmapSurface() -- surfaces are now
674 automatically mapped on blit.