Thursday, 5 December 2024

Bricking Brick with SDL3

Decided to switch Brick Atelier to SDL3 from SDL2. One of the reasons was that SDL3 now has a native file dialog function that removes the need to include windows.h and use a weird hack to call the windows file dialog. SDL3 has changed quite a lot, both function and define names have changed. In Brick Atelier it was possibly harder to migrate, because it's using several event loops etc. But I got there in the end and the file dialog is working, too. It does require an event waiting loop and some funny programming, because it is a callback routine.

However the worst change in my mind was moving from int-based rectangles to SDL_FRect and also mouse coordinates are now float. I guess there is a technical reason for this because GPUs are using float coordinates presumably, but it has been a total chaos in int to float conversions. I am going to fix them all, because I don't like to leave that kind of type conversions, but it takes some time.

I can now compile Brick Atelier in linux I hope, because it no longer requires windows.h. I have not yet tried it, but it should work. Other than that I try to code some difficult features like moving the brushes in the brush pad and also rotation. Some of these features are surprisingly hard to implement, it's no wonder why there are so few drawing programs.

Christmas is getting close. I don't like it, but for family reasons I have to get presents and all that annoying stuff. Christmas is a resource hog, so much crap is produced. I try to figure out presents that are practical and have some kind of use. What I wish is world peace for Christmas.

No comments: