[personal profile] lmemsm
There are still lots of great programs that only work with SDL 1.2.x and haven't been ported to SDL 2.x yet. There are also some operating systems that have not yet added a port of SDL 2.x and are still using SDL 1.2.x. SDL 1.2.x has support for Linux framebuffer which SDL 2.x does not offer. So, I've been finding myself supporting both SDL 1.2.x and SDL 2.x development environments. I am porting SDL 1.2.x programs that I commonly use so that they'll work with SDL 2.x as well. I have more than a half dozen converted but have a long way to go. A list of the SDL applications I use most frequently is here: https://lmemsm.dreamwidth.org/1855.html If you know of other ports of these programs to SDL 2.x, please share the information. A list of some of what I've already added SDL 2.x support to is available from here: http://www.distasis.com/cpp/lmports.htm

There are several helper libraries, I consistently use when working with SDL. I've been trying to pare it down to a minimum, but there are some I can't do without. These include sdl_ttf/sdl2_ttf, sdl_gfx/sdl2_gfx, sdl_image/sdl2_image and sdl_mixer/sdl2_mixer. I've been able to replace sdl_draw (which I did port to SDL 2 at one point) with sdl2_gfx in all the applications that used it as a dependency. I don't really use sdl_net. I tend to prefer to use programs offline and not be connected to the Internet just to have a program work. I haven't found a real need for sdl_audio. sdl_mixer seems to be good enough for most programs that provide audio.

Still, four libraries for SDL 1.2.15 and four for SDL 2.x can be a lot to keep up with. Also, the SDL 2 versions of these libraries have added some nice features like better Unicode/UTF-8 support for sdl2_ttf and support for newer image formats like svg in sdl2_image. They'd be nice to have in SDL 1.2.x.

When I was porting unicodeview to SDL 2.x, I needed to make some patches to sdl2_ttf similar to the ones needed for sdl_ttf just to get the unicodeview program to work. Neither sdl_ttf or sdl2_ttf has great support for UTF-32. sdl2_ttf does have better support for UTF-8 than sdl_ttf. So, I wanted to use the UTF-8 improvements in sdl2_ttf to improve Unicode and UTF-32 support in sdl_ttf. When I looked at the sdl2_ttf code and compared it to sdl_ttf, I realized they were similar enough one could still use sdl2_ttf with SDL 1.2.x. So, I decided to start using sdl2_ttf for both SDL 2.x and SDL 1.2.x builds.

sdl_gfx is an interesting case. sdl2_gfx only works with SDL 2.x. However, the developer has patches for sdl_gfx to get it work with SDL 2.x as well. I actually found one of my SDL 2.x programs worked faster using sdl_gfx instead of sdl2_gfx. So, I have versions of sdl_gfx for both SDL 1.2.15 and 2.x along with the option to use sdl2_gfx with SDL 2.x applications. The programs I've been patching that require one or the other or that used to need sdl_draw can now use any of those 3 options.

Since I've added support for both versions of SDL to other libraries, I decided it was time to look at the code of all the support libraries I use for SDL and see if I could combine the rest of them. I just completed patching SDL2_image so it will still work with SDL 1.2.x. I tried it with a build of picaxo and I can now view svg in the SDL 1.2.x build of picaxo not just the SDL 2.x build. Will also be looking at sdl_mixer.

I could just patch the programs to make these changes, but I find it easier to use my own build tools when trying to make modifications. So, I've ported all the libraries I'm working on to build with CDetect, GNU make, pkgconf and a shell (usually bash) build script. I no longer need the entire GNU autotools toolchain to build them. I don't need cmake either. I find it really easy using my own build system to switch between the SDL 1.x and SDL 2.x builds. I just need to change one define and generate the appropriate build script. I also find it easier to build these libraries for more unusual systems like Android using my own build tools.

I know there are still some systems out there that are using SDL 1.x in place of SDL 2.x especially those that do not have a SDL 2.x library port readily available. Most of the SDL 1.x helper libraries haven't been updated or had features added since development switched to a newer version of SDL. Would think updated versions of these libraries would be nice for systems still using SDL 1.x. If you're working on a system like that or are interested in porting software so that it works with different versions of SDL, contact me. It would be nice to combine efforts on a project like this.

If anyone wants to try some of these changes out, I will be uploading my patches and build scripts to:
http://www.distasis.com/cpp/lmports.htm

April 2025

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
27282930   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 24th, 2025 07:15 am
Powered by Dreamwidth Studios