Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.
/ SFML_Starter Public archive

A very simple starter setup for an SFML game with a minimal finite state machine (FSM).

License

Notifications You must be signed in to change notification settings

kiswa/SFML_Starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SFML Starter

A very simple starter setup for an SFML game with a minimal finite state machine (FSM).

Use

Clone the repo git clone https://github.com/kiswa/SFML_Starter, enter the directory you cloned into, and run cmake . (note the . after the command). This should generate the necessary project files to build on your system.

For Linux, follow this with make and you will have an executable named sfml which you can run to see the demo.

What's Included

All source files are in the src directory.

  • main.cpp The main entry point that starts everything going.
  • game.*pp The Game class contains a GameData struct that holds the FSM, Asset Manager, and SFML Window.
  • asset_manager.*pp The AssetManager class provides long-lived access to sf::Textures and sf::Fonts.
  • state_machine.*pp The StateMachine class is just a simple wrapper around a std::stack which handles transitioning between states.
  • state.hpp The State class is an abstract class that each state inherits.
  • game_state.*pp The GameState class is a simple implementation of a game state to show how it might be used.
  • pause_state.*pp The PauseState class is just to demonstrate changing states without replacing the current state.

Credits

The "alien" image is courtesy of Kenney.

The font used is Fira Mono from Mozilla (specifically, FiraMono-Regular.otf).

About

A very simple starter setup for an SFML game with a minimal finite state machine (FSM).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published