Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Progress Report: Upgrading to SDL3

Last time, I reported that I had started working on my first sprint for a Major Update(tm) for my strategic leaf-raking business simulation game, Toytles: Leaf Raking.

This past week I started the work of migrating my code from libSDL2 to libSDL3.

Sprint 2025-MJ_2: Preproduction

In progress:

  • Update SDL2 to SDL3

Toytles: Leaf Raking

Technically, this work started in the previous sprint, but it was a very short sprint that started near the end of the week.

Also, this is a somewhat technical update.

Years ago, I wrote an abstraction over my usage of SDL2. SDL3 is a major change from SDL2, but I anticipated that the impact should be isolated to a few files that directly reference SDL2.

Even so, I’m finding that while many variables, constants, and functions are merely renamed, there are some areas in which SDL3 changed how it does things, or at least there is enough change that it requires me to spend time digging into it to determine if the changes are relevant to what I am trying to do.

For instance, the SDL2 to SDL3 Migration Guide mentions that “SDL_WINDOW_FULLSCREEN_DESKTOP has been removed” and that “Windows now have an explicit fullscreen mode that is set, using SDL_SetWindowFullscreenMode()” which makes it sound like I can’t do what I did in SDL2, which is use SDL_CreateWindow() for either fullscreen or resizable windows.

But when I looked into it, SDL_CreateWindow() still lets me pass in a SDL_WINDOW_FULLSCREEN flag. Creating a fullscreen window is still fine, but the way to set an existing window as fullscreen is different…something I never do in my code, so I don’t have to worry about handling this change in my own code.

It’s a little tedious, but the migration guide is very helpful, and the error codes are incredibly helpful:

include/SDL3/SDL_oldnames.h:1168:26: error: ‘SDL_RendererFlip_renamed_SDL_FlipMode’ does not name a type
 1168 | #define SDL_RendererFlip SDL_RendererFlip_renamed_SDL_FlipMode

That’s very thoughtful of the SDL3 developers!

And it also gives me an opportunity to look through some of my oldest parts of my code to see if there is anything I can also cleanup.

My hope is that I can get this migration work accomplished quickly early this week, and then I can make sure that the game still runs the same as before. Then I can start the work of updating the game itself.

Thanks for reading, and stay curious!

Want to learn about future Freshly Squeezed games I am creating? Sign up for the GBGames Curiosities newsletter, and download the full color Player’s Guides to my existing and future games for free!

One reply on “Freshly Squeezed Progress Report: Upgrading to SDL3”

Leave a Reply

Your email address will not be published. Required fields are marked *