snowcone-ltd / libmatoya

Cross-platform application development.
MIT License
592 stars 53 forks source link

Draw multiple quads in the same loop iteration #43

Closed Namaneo closed 2 years ago

Namaneo commented 3 years ago

Back with a proposal this time: I need to draw multiple quads in a single loop iteration (the game frame and buttons for a virtual controller), drawn at different positions of the viewport.

As far as I've seen, there were two ways to implement that:

I chose to go for the first solution as it seemed to be less invasive on the code-base, and does not break any existing usage if the library (excluding a required matoya.h update on the end projects).

Also, as OpenGL is the only one with a bottom-left origin, I transform the image positions used with this GFX to make it top-left instead.

What do you think? :slightly_smiling_face:

Namaneo commented 3 years ago

Hey, quick update on this one: I just tested those modifications with all available GFX (as I finally could get my hand on an OSX device). Everything is working as expected, with the same behavior across platforms.

Namaneo commented 3 years ago

Well, I've gone a little further on the tests regarding the bottom-to-top tranformation. While this is working correctly using MTY_WindowDrawQuad, it does not when using MTY_RendererDrawQuad with a viewport size that does not match the window size. I tried to find a elegant workaround, but I felt like it was safer to let the user perform its own calculations based on the GFX in use.

This part has been reverted, let me know if there's a solution I haven't seen!

Namaneo commented 2 years ago

Addressed in #51.