-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to SDL 2.0 #135
Migrate to SDL 2.0 #135
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks so much, this will be useful [Edit I meant to 'not yet' fully approve/merge the main commit, just the small one, see comments below]
Edit have created an issue also for this for possible discussion area also: #140 Thanks for this! Just some first glance comments: Love it, this is awesome. SDL2 support would be great and I love this (have wanted SDL2 support for a long time ... being on SDL1.2 has caused some pains in the past) but I'm hesitant to just jump and merge entire thing right away as there are quite a few prior ports and build setups/configs already set up for SDL1.2 and I don't want to just break them (I'm a bit sometimes overly cautious 'not to break things') ... my feeling would be ideally (time permitting) to try maybe merge these in a 'phased' slightly cautious way like: (1) Create say a #define so we can toggle in Makefile settings between SDL1.2 and SDL2 (3) Once all ports happily on 2.0 etc. and more testing has been done try start switching to 2.0 as default (though not sure then how to best handle the dependencies in files like https://github.com/davidjoffe/dave_gnukem/blob/master/debian/control) It's debatable if that's overkill for a small retro game; I'm typically very cautious about changes that might break existing ports. Some small merge conflicts we'd just have to resolve also but nothing too serious at this stage - but I worry the longer I wait those merge conflicts could grow harder to merge. But my schedule very busy right now so it's difficult to find a spare 'weekend' to look at all this right now. Another possibility is to just start with SDL2 support in a separate feature branch, e.g. I could create a new feature branch on the main project for SDL2 support, and maybe start by trying to merge these changes into the new feature branch - that gives some for testing also without breaking main, once it's all looking good can start maybe jumping to SDL2 or something. For ports like Debian or BSD I could use VMs no problem but there are I think a couple of hardware ports I don't have the hardware to test myself. I also don't know if there might be some platforms that are 'stuck' on 1.2 forever? Not sure. But really 1.2 is 'too old' ... it's caused some problems on some platforms (e.g. Mac) |
Ok, I've been looking closer at this commit and doing some more tests - a few small things to fix with but nothing major, overall looks good and promising ... I'll do a good think about the best path forward here, but am (tentatively) leaning toward merging this in sometime very soon to the main Dave Gnukem branch - not immediately but very soon hopefully in the next week or two |
Just merged! Now must fix a few things quickly. |
As the title says, this a simple way to migrate to SDL 2.0.
Most of the rendering is still done in software using SDL_Surfaces at the game base resolution, 320x200. Then, when the frame is ready, we update the SDL_Texture of the main djVisual and we let the GPU scale the texture to the window size.
Scaling is now done by the GPU, even for the retro display modes. This approach allows us to have a resizeable window "for free", moreover full screen for different aspect ratios is always scaled correctly and to the monitor desktop resolution too.
Certainly the rendering code can be further improved, but it's nonetheless a good starting point.
Fixes #122.
Reference:
https://wiki.libsdl.org/MigrationGuide