Update about the SDL2 demo.

master
Zed A. Shaw 7 months ago
parent 23def1ac97
commit 8425872f5e
  1. 17
      README.md

@ -22,6 +22,19 @@ To get this working the rough (ROUGH) steps are:
I'll have more extensive instructions in a later blog post, but if you have time try this out and let me know how it went at help@learncodethehardway.com. Please let me know if you tried a different compiler, Windows version, etc. If you're on OSX or Linux it should work the same but Linux people might want to use their package manager instead.
## Next Step
## SDL2 Test
Once this is mostly working and documented I'll start the process of learning C++ and then work on a bunch of silly little games to learn how it all works.
One of the goals is to use a simple framework that provides many things people need for a game. SFML fits this goal because it comes with graphics, audio, network, and threads in one C++ library. It's also useable from multiple languages, not just C++, so it has more potential for spin-off courses in the future. Finally, the same code seems to work the same on all platforms.
I added one more subproject `sdl2demo` since I know I'll get people asking, "Why don't you just use SDL2?!" This uses a similar build to the SFML build, but it just creates an SDL2 window without ImGUI. Why you may ask? Because SDL2 is not really cross platform. If you look at the [ImGUI+SDL2](https://github.com/ocornut/imgui/blob/master/examples/example_sdl3_sdlrenderer3/main.cpp) demos you'll notice this list:
* example_sdl2_directx11
* example_sdl2_metal
* example_sdl2_opengl2
* example_sdl2_opengl3
The list goes on, and on, and each of these has slightly different code. You have to make different contexts, different variables, different options, depending on if you're on OSX Metal vs. OpenGL2 and it looks like there's no "just render in the window" option. Add onto this the problem that SDL2 seems to be the only "Game Library" that doesn't have built-in audio? You have to use [SDL_Mixer](https://github.com/libsdl-org/SDL_mixer). Do you need to load images (very common in a game), you need [SDL_Image](https://github.com/libsdl-org/SDL_mixer).
Finally, SDL2 works fine in C++ (as demonstrated by the `sdl2demo`) but SFML is actually C++ so working with it is going to be easier. It can also be a nice study project for people who want to learn more. With SDL2 there's a constant mental translation going on between C and C++, so it's not going to be as attractive for education.
When you combine the lack of cross platform code, the lack of C++, and the need to use many different libraries just to make SDL2 as capable as SFML, I'm going with SFML for the course. If you have a nice demo that shows me a single piece of code that compiles everywhere and has everything like the SFML demo then show me. I'm always open to be proven wrong.

Loading…
Cancel
Save