Add Sdl2 backend#1451
Open
TonalidadeHidrica wants to merge 21 commits intoPistonDevelopers:masterfrom
Open
Conversation
Contributor
|
Nice work! I'm happy you found the old PRs useful, and thank you for the mention :) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the Take 3 of providing SDL2 backend for cornod.
I didn't use OpenGL
When it comes to using SDL2, there are a big choice: to use OpenGL or not to use. In the prior art,
cornod_gfxetc) but used only the feature of "pure SDL2" (includingSDL2_gfx).In this PR, I took the course of not using it, because I wanted to keep the dependencies minimal.
I checked that all the features of
DemoAppworks, but feel free to pointing out anything I am missing.Credits go to:
About Rust version
Since I could not find the information of MSRV, I developed
conrod_sdl2crate with1.57.0and Rust 2021 Edition. If I should use older ones, I would update the code.About the addition to the dependency
I added
thiserrorto minimize the boilerplates on error handling, andsmallvecfor a iterator-friendly container of up-to-two events. If this matters, let me know and I'll think the other way.Notes on graphics
When you run

all_sdl2, you will see the thin diagonal lines as well as horizontal and vertical noize-like lines. These are probably due to overlapping extremely-thin transparent triangles. Unlike GL families, triangles in SDL seems not be cut out for forming complex polygons from many triangles. I think this is inevitable, as long as we use pure SDL2.