This repository holds the example code originally used for a SFML Workshop at the C++ Usergroup Zentralschweiz. If you find something to improve, don't hesitate to reach out or send a pull request.
The most basic game loop using SFML.
- Basic game loop
sf::RenderWindow
sf::Event
Move are a colored rectangle one keyboard button press at a time.
- Clear, draw, display
sf::RectangleShape
sf::Keyboard
sf::Event::KeyPressed
&sf::Event::KeyReleased
sf::Vector2<T>
Scope the application inside a class, thus allowing to share variables across multiple functions.
- Basic game structure
Replace the colored shape with some picture.
- Resource management
sf::Sprite
sf::Texture
Render the map based on fixed integer values.
- Basic map handling
sf::Drawable
Box entities need to be rendered separately.
- Collision detection
- Enum for types
Play some background music and make some noise when moving.
sf::Music
sf::SoundBuffer
sf::Sound
Display a 'You Won!' text when the win condition is reached and show the steps taken.
sf::Font
sf::Text
This software is dual licensed under the Public Domain and the MIT license, choose whichever you prefer. See the LICENSE.md file for more details.
Note: The used assets do not fall under this license, but they are all licensed either CC0 or in the public domain