Best way to learn 2d games with D?

Mike Parker aldacron at gmail.com
Mon Mar 16 03:03:15 UTC 2020


On Sunday, 15 March 2020 at 21:33:29 UTC, Arine wrote:

>
> I wouldn't use SDL2 for rendering. It is really just there for 
> legacy. The only thing people use SDL2 is for setting up a 
> window and creating a render context for OpenGL/Vulkan/Directx, 
> along with handling input/events.
>

There's no need for someone just learning 2D games to implement 
their own OGL/Vulkan/DX renderer. The SDL2 rendering API is 
plenty fine.

And it isn't just for "legacy". It was supposed to be an 
enhancement over SDL's old SDL_Surface API. When they first 
implemented it, they restricted it to the features they 
implemented cross-platform in software. It also didn't do any 
batching for the hardware rendering. As of SDL 2.10, they have 
batching for the hardware renderers, which makes it even more 
usable.

The only time I would recommend against the SDL2 renderer for a 
2D game is when you A) already have your own renderer implemented 
anyway, or B) need some fancy shader effect. I've seen people get 
some decent F/X with the SDL2 renderer, but it's limited in that 
regard. Still no need to implement a custom renderer, though, as 
SDL_gpu opens the doors to shaders.


More information about the Digitalmars-d-learn mailing list