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

WIP: Add new SDL_Renderer APIs #1216

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

Conversation

moralrecordings
Copy link
Contributor

  • Builds on the changes from Update bindings to SDL 2.0.20 #1213 . Once that's merged, this should look a bit less spidery.
  • In honesty the main thing I wanted to see added was SDL_RenderGeometry and SDL_RenderGeometryRaw.
  • SDL_RenderGeometry depends on the new SDL_FPoint and SDL_Vertex structures, which I was able to create as wrapping the underlying C type (like SDL_Point).
  • pixels::Color predates bindgen, meaning it doesn't directly wrap SDL_Color. A new type that does so has been provided with pixels::RColor. pixels::Color has been deprecated, and any function needing a color type now uses the generic Copy + Into<RColor>, which should keep older code working.
  • The validation logic for InternalTexture::update_nv I nicked verbatim from InternalTexture::update_yuv, and I'm not sure if it works. My understanding from this page is that the UV plane in NV doesn't have half the stride like the individual U and V planes in YUV?

TODO:

  • SDL_RenderGeometryRaw needs rethinking. The C version does everything with pointers and strides, so it supports the pattern of having one array per data type, and the pattern of having one array with different data types interleaved. My wrapper goes for option 1, but loads of things go for option 2. Maybe the solution is to make a second wrapper, which takes vertex: &[T] and a byte offset for each data type, then finangle Rust to somehow do the right thing...

@kellerkindt
Copy link
Contributor

Any updates on this? I would really like to see the fn geometry to land. Maybe the wrapper for the SDL_Color type should just be Color (implying a breaking change?), because the prefix of RColor doesn't fit so well in the long run? (after the current Color was deprecated and then removed)

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