@ -12,16 +12,30 @@ Another way to put this is I want to teach people how to make games that don't c
The `sfmldemo` currently contains a very bare build using [Meson](https://mesonbuild.com) to build a [SFML](https://www.sfml-dev.org) project. This currently builds on Windows with MinGW but I haven't tested it anywhere else. The build takes the [example code from imgui-sfml](https://github.com/SFML/imgui-sfml) and makes it work, so you have a game window with a working GUI in it already. That is actually remarkable feat on Windows.
To get this working the rough (ROUGH) steps are:
### Windows
1. Get MinGW and Meson installed.
2. Run setup.ps1
To get this working the rough (ROUGH) steps on Windows are:
1. Get MinGW and [Meson](https://mesonbuild.com/) installed.
2. Run `.\setup.ps1`
3. `meson compile -C builddir`
4. `.\builddir\sfmldemo` -- That should run it and you see a window with ImGUI's demo panel.
**WARNING**: You should look in the `setup.ps1` and `reset_build.p1` files for how a build is actually configured. The most important line is at the bottom `meson setup -Ddefault_library=static builddir` which properly configures the build so that the `sfmldemo.exe` program actually runs. Without the `-Ddefault_library=static` the `sfmldemo.exe` file will not have the `.dll` files it needs and will silently fail. If it fails to start then run `start builddir` and double click on it to get the error messages. Then run `reset_build.ps1` to get a good build.
### OSX
1. Get XCode and [Meson](https://mesonbuild.com/) installed.
2. Run `./setup.sh`
3. `meson compile -C builddir`
4. `meson install -C builddir` -- Careful with this, it might install stuff in unwanted areas. On my computer it put them in `C:\` but I have to read the instructions on how to set the install location.
5. `./builddir/sfmldemo` -- That should run it and you see a window with ImGUI's demo panel.
4. `.\builddir\sfmldemo` -- That should run it and you see a window with ImGUI's demo panel.
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.
## Linux
I actually don't have a Linux computer ready to test, but if you have a brand of Linux you like then try the OSX instructions and email me at [help@learncodethehardway.com](mailto:help@learncodethehardway.com).
## SDL2 Test
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.
@ -38,3 +52,7 @@ The list goes on, and on, and each of these has slightly different code. You ha
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.
## Next Test
A more complete demo that uses the various features of SFML, like audio and maybe joystick controls. The idea is to create a "spike" that runs the major features of SFML in order to make sure they're available on different platforms.