In this article SDL vs SFML, I will try to expose the advantages and disadvantages of each API from a game developer point of view.
SDL vs SFML
Pros
- Nintendo Switch support, could be ported to other game console.
- directX context support
- Vulkan support
- Low level library
- Lots of extension libraries to load fonts, images , musics, have network and shapes.
Cons
- Barebone without extension libraries
- No sprite batching, need to use SDL_gpu to support it
- Dependencies complexity
- No support for texture compression
- No GUI extension, but you can use GUI libraries that use an OpenGL context.
SFML vs SDL
Pros
- High level library
- Syntax is less verbose
- Font, images, musics, network, shapes handling integrated with the main library.
Cons
- Vulkan support experimental
- No directX support
- Limited sprite batching with vertex arrays
- No support for texture compression
In my opinion, I think SFML is easier and faster to use for prototyping because you don’t have to download and configure seven extensions libraries (SDL_image, SDL_mixer, SDL_ttf, SDL_gfx, SDL_gpu, SDL_net, SDL_rtf).
But if you want to ship a game, and you already know exactly what you need and what platform you want to support, SDL is a better fit in my opinion.
In each case, you will need to add other libraries for :
- play videos (TheoraPlay for SDL and sfeMovie for SFML)
- Have a GUI
- Sprite batching