SFML Template to start with your game

If you have setup SFML  with the tutorial that I wrote, the example is easy but is not very useful if you want to create more complex games. In this post, I going to show you how I create a simple Game class to have more control about the game loop, the user input and the frame rate. First, you need to create a Game.h and Game.cpp files. In your Game.h write this code #ifndef GAME_H #define GAME_H #include <SFML/Graphics.hpp> class Game { public: Game(); void Run(); private: void processEvents(); void update(sf::Time deltaTime); void render(); void handlePlayerInput(sf::Keyboard::Key key, bool isPressed); sf::RenderWindow mWindow; …

Read moreSFML Template to start with your game

SFML 2.5.1 setup on macOS with CLion

I know that the title is very specific but that is the platform that I am doing some experiments with SFML. So, if you want to create games with SFML and you have macOS and you want to use CLion as IDE just follow the next steps: Install SFML There are a lot ways to install SFML but the easiest is to install it with brew brew install sfml With this command, you’re going to install the version 2.5.1. Create the project with CLion Now is time to create a new project with CLion, put the name that you want …

Read moreSFML 2.5.1 setup on macOS with CLion