SDL 1.3 Migration Guide

Hi,

I wrote a first version of a “SDL 1.2 to 1.3 Migration Guide” on the
SDL wiki:

http://wiki.libsdl.org/moin.cgi/MigrationGuide

Currently it mainly cover graphics, but also looks at events and
extensions.

What do you think? Comments? Suggestions? Flames? :wink:

Cheers!–
Sylvain

You may include reference to this file as an example how to convert your
game to SDL 1.3 more-less painlessly:

https://github.com/pelya/commandergenius/blob/sdl_android/project/jni/application/alienblaster/SdlForwardCompat.hOn Sun, Nov 14, 2010 at 6:37 PM, Sylvain Beucler wrote:

Hi,

I wrote a first version of a “SDL 1.2 to 1.3 Migration Guide” on the
SDL wiki:

http://wiki.libsdl.org/moin.cgi/MigrationGuide

Currently it mainly cover graphics, but also looks at events and
extensions.

What do you think? Comments? Suggestions? Flames? :wink:

Cheers!


Sylvain


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Good point, I grouped migration strategies and mentioned that header:

http://wiki.libsdl.org/moin.cgi/MigrationGuide#Strategies

Copy below:

== Strategies ==

Here we discuss migration strategies for your code base.

Basic technique: here’s how to detect the current SDL version:
{{{
#if SDL_VERSION_ATLEAST(1,3,0)
/* SDL 1.3 code /
#else
/
SDL 1.2 code */
#endif
}}}

=== Rewrite ===

The most obvious one: drop SDL 1.2 and rewrite everything for 1.3.

=== Backward-compatibility ===

There are good chances that your current 1.2 code will directly compile under 1.3. Check {{{include/SDL_compat.h}}} and {{{SDL/src/SDL_compat.c}}} to get an idea.

Your code will probably run slower though; in particular there will be no hardware surfaces.

Compatibility is not 100% correct though; for instance {{{SDL_SetPalette}}} flags are currently ignored.

=== Forward-compatibility ===

You may want to support both libraries, for instance because SDL 1.2 is currently better supported on your platform, or better packaged in GNU/Linux distros.

The !AlienBlaster code, in the Android port repository, uses a few additional functions on top of SDL, that will use either SDL 1.2 or 1.3 seemlessly, and minimise the amount of #ifdef. It’s not completely fool-proof though, for instance blits between hardware surfaces will result in a no-op under 1.3. Check the C++ code at:

[[http://github.com/pelya/commandergenius/blob/sdl_android/project/jni/application/alienblaster/SdlForwardCompat.h]]

  • SylvainOn Sun, Nov 14, 2010 at 08:26:48PM +0200, Sergiy Pylypenko wrote:

You may include reference to this file as an example how to convert your
game to SDL 1.3 more-less painlessly:

https://github.com/pelya/commandergenius/blob/sdl_android/project/jni/application/alienblaster/SdlForwardCompat.h

On Sun, Nov 14, 2010 at 6:37 PM, Sylvain Beucler <@Sylvain_Beucler> wrote:

Hi,

I wrote a first version of a “SDL 1.2 to 1.3 Migration Guide” on the
SDL wiki:

http://wiki.libsdl.org/moin.cgi/MigrationGuide

Currently it mainly cover graphics, but also looks at events and
extensions.

What do you think? Comments? Suggestions? Flames? :wink:

Cheers!

Nice start !
For sure it will help many people.

Julien CLEMENT
@Julien_Clement1