Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Simple SFML Game Starter Setup  (Read 3213 times)

0 Members and 1 Guest are viewing this topic.

kiswa

  • Newbie
  • *
  • Posts: 10
    • View Profile
Simple SFML Game Starter Setup
« 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.
« Last Edit: May 08, 2015, 02:11:13 pm by kiswa »

paupav

  • Full Member
  • ***
  • Posts: 156
    • View Profile
    • Email
Re: Simple SFML Game Starter Setup
« Reply #1 on: May 10, 2015, 09:47:05 pm »
Thanks  ;)

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Simple SFML Game Starter Setup
« Reply #2 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).
« Last Edit: May 12, 2015, 12:26:27 pm by Mario »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
AW: Re: Simple SFML Game Starter Setup
« Reply #3 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.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Simple SFML Game Starter Setup
« Reply #4 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).

kiswa

  • Newbie
  • *
  • Posts: 10
    • View Profile
Re: Simple SFML Game Starter Setup
« Reply #5 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

 

anything