ooxi / violetland

An open source cross-platform game similar to Crimsonland
https://violetland.github.io/
Other
66 stars 16 forks source link

Move to SDL2 #149

Open shamazmazum opened 5 years ago

shamazmazum commented 5 years ago

Hello. This is my attempt to move to SDL2, making it possible to run this game natively on Wayland. The attempt is almost succeeded, but you cannot change screen resolution without restart now :(

So this is what you get:

And you cannot change screen resolution on the fly (You'll see a window saying to restart the game).

The latter really disappoints me and goes from the fact that GL context is now attached to a window (in SDL2 you can have many windows). So to resize a window you need to deal with already created one (or you need to reinitialize the whole GL context). I've tried to resize a window with SDL_SetWindowSize() if the game is in windowed mode (here is a link to the documentation), but for some reason the size does not change. Maybe the window must have SDL_WINDOW_RESIZABLE flag, but I think it is for WM/compositor. If you know how to solve this using SDL2, let me know. And if you think, it is OK to merge, I will be much grateful.

ooxi commented 4 years ago

Wow this is huge, thank you very much! I will need some time to test this and come back to you. Most likely a couple of commits will need to be squashed or merged before the SDL2 conversion, but all in all this looks very promising!

ooxi commented 4 years ago

Just to give you an update on this, currently looking into your patch. I will first fix the build on master in order to have reliable Travis CI information and then squash merge your patches, if no other issues com up.

ooxi commented 2 years ago

Unfortunately I was not able to verify this patch. Have you tested it on multiple platforms?