Best way to learn 2d games with D?

Arine arine123445128843 at gmail.com
Mon Mar 16 16:19:26 UTC 2020


On Monday, 16 March 2020 at 03:03:15 UTC, Mike Parker wrote:
> 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.

There's no need for someone learning 2D games to even bother with 
SDL2 to begin with. If you use SDL2 you are going to be using 
something no one else uses, you'll be wasting your by using 
something that isn't that good and what you learn from it won't 
be that useful. I don't know anyone that uses SDL2 actual API for 
rendering. Using OpenGL and similar API, you'll learn how data 
actually needs to be processed. If you just want to mess around 
with making a game, using a game engine like Unity is going to be 
better for that. No one should waste their time with SDL2's 
rendering API, it is awful and doesn't actually teach you 
anything about how rendering actually works.

So in either case, whether it be games you want to make, or game 
engines. You are better off not learning SDL2 rendering, as it 
would just be a waste of time.


More information about the Digitalmars-d-learn mailing list