flecs-hub/flecs-systems-sdl2

Displaying textures

lambdadog opened this issue · 2 comments

I'm looking to render textures using flecs and SDL2, and so far in working with flecs have been using the flecs.components.graphics and this module, but looking through the code I'm starting to find that it doesn't seem like I'm going to be able to move forward with them in any reasonable way? The only approach I can imagine off the top of my head other than forking the library is creating my own add-on graphics components, and disabling the SdlRender2D System, copying it, modifying it to handle my own graphics components and using my copy, and at that point it's more worth it to fork.

Have I missed an obvious solution to this problem? It's possible that there's some way for me to write a system I can guarantee will run after SdlRender2D, but I'm not familiar enough with the rules of flecs to say for sure off the top of my head. I suspect the answer may just be to fork it, but some clarification would be very welcome

Current module implementation is slow and feature incomplete.

@SanderMertens just began work on new rendering module that will be way faster and flexible, you can find it there: https://github.com/flecs-hub/flecs-systems-sokol.

It uses SDL for application backend and sokol for rendering, be warn that is still WIP and only support MacOSX platform.

Also there is demo how image are drawn via sokol: https://floooh.github.io/sokol-html5/loadpng-sapp.html

@SanderMertens What future of this module after sokol module implementation?

@transitracer The current SDL module, as @ArnCarveris indicated, is not feature complete. That said, it can definitely be extended with more functionality, for as far as the SDL rendering API permits (and it does support images).

I don't have time at the moment to work on this, but if you were to fork it and get the code base to where you want, I would be more than happy to merge it back into master! The SDL rendering API is pretty straightforward, the only thing that is missing at the moment is the component(s) to describe images in flecs.components.graphics as you already pointed out, and the systems in flecs.systems.sdl2 to do something with them.

Also note that the flecs modules aren't meant to be a one-size-fits all. They are primarily there for reference and to provide a quick prototyping environment, so feel free to fork and modify as you like :)

If you have any ongoing questions about Flecs or what the best way to implement something is, you can always ask questions on the gitter channel:
https://gitter.im/flecsdev/community#