SFML community forums

General => SFML projects => Topic started by: kiswa on May 08, 2015, 02:09:29 pm

Title: Simple SFML Game Starter Setup
Post by: kiswa on May 08, 2015, 02:09:29 pm
I made this for myself to have a basic starting point for making games with SFML, and I thought someone else might find it useful/interesting.

https://github.com/kiswa/SFML_Starter

It uses CMake (though only tested on Linux, so please let me know if it needs changes for other platforms) and builds an executable named "sfml" which demonstrates the state transitions and debug output.

It includes an asset manager which currently only manages sf::Texture and sf::Font objects, but more will be added once I make a game with it. Have a look through the code and let me know if there's anything that could make it more useful (or if it has any bugs).

EDIT: I should mention that it assumes C++11 and SFML 2.2.
Title: Re: Simple SFML Game Starter Setup
Post by: paupav on May 10, 2015, 09:47:05 pm
Thanks  ;)
Title: Re: Simple SFML Game Starter Setup
Post by: Mario on May 12, 2015, 12:00:00 pm
Two things I've noticed:

* You should include FindSFML.cmake and set CMAKE_MODULE_PATH to point to its folder.
* You have to add the include directories for SFML.
* You should link the libraries set by the SFML module (SFML and its dependencies).

Edit: Made a pull request with the suggestions included. There's still some issue when running under MSVC 12 though (exception due to accessing top on an empty state stack).
Title: AW: Re: Simple SFML Game Starter Setup
Post by: eXpl0it3r on May 12, 2015, 12:12:01 pm
* You should include FindSFML.cmake and set CMAKE_MODULE_PATH to point to its folder.
When you do that, make sure to update the FindSFML.cmake whenever SFML updates it.
Title: Re: Simple SFML Game Starter Setup
Post by: Mario on May 12, 2015, 12:27:01 pm
Yep, of course. But for a beginner project it's still better to include it, since SFML won't install it where CMake finds it (by default).
Title: Re: Simple SFML Game Starter Setup
Post by: kiswa on May 19, 2015, 02:09:14 pm
Thanks for the PR, I merged it yesterday. I've had a death in the family, so things are taking me a while now.

If anyone is interested, please consider a donation to the Wounded Warrior Project (in honor of my brother, Christopher Traver). https://support.woundedwarriorproject.org/default.aspx?tsid=72