Skip to content
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

Add Sdl2 backend #1451

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

TonalidadeHidrica
Copy link

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,

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 DemoApp works, but feel free to pointing out anything I am missing.

Credits go to:

  • @elrnv for event conversion code. I copy-pasted all your work (but included as the author when committing that part!).
  • @jonas-schievink for how to render text. Although I refined the implementation and adopt newer APIs, the work could have not been done without your code.

About Rust version

Since I could not find the information of MSRV, I developed conrod_sdl2 crate with 1.57.0 and Rust 2021 Edition. If I should use older ones, I would update the code.

About the addition to the dependency

I added thiserror to minimize the boilerplates on error handling, and smallvec for 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.
image

@elrnv
Copy link
Contributor

elrnv commented Jan 7, 2022

Nice work! I'm happy you found the old PRs useful, and thank you for the mention :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants