The TLDR is at the end.
This folder was created for sfml learning in the context of the 2023 C++ programming language course in Claude Bernard University (Lyon 1). It’s composed of example codes that are heavily commented.
The way of learning I imagined with this project is “monkey-see-monkey-do”, it gives little pieces of code that are commented and that allow simple sfml usage. Then, from these examples, you can build more complex and personal projects!
Take them as lego pieces you can use for your own projects.
level A is for very basic sfml usage, this is where you should begin. It has sublevels going from level0 to level2:
- level0
- sfml_linux_base_tuto: displays a green circle in the middle of a 200x200 window
- level1
- sfml_graphics_tuto: displays a green circle, a text, and a rectangle
- sfml_mouse_event_tuto: prints on the terminal the position of your mouse if you click inside the created window
- level2
- sfml_mouse_interaction_tuto: moves a circle where you click, inside the window
- sfml_button_hover_toggle_tuto: colors a rectangle in green if you hover your mouse
level B is for basic usage of sfml AND usage of less simple C++ objects (for instance table arrays, class…). It is recommended to make sure that you at least understand each tiny examples in level_A before going in this level. It also requires a little more knowledge on C++ language (but nothing too fancy, “just” simple class, or structures.)
- level0
- sfml_mouse_interaction_tuto: colors the line you click on in the created window (it uses an array)
- level1
- creates a re 637D ctangle that switch colors when you click on it (it uses a created “ToggleButton” class)
- sfml tutorials website https://www.sfml-dev.org/tutorials/2.6/
- how to make sfml work with codeblocks https://www.sfml-dev.org/tutorials/2.6/start-cb-fr.php
Si vous voulez utiliser sfml pour votre projet et que vous êtes bloqué·e, vous pouvez m’en parler et on essayera de régler le problème ensemble. Par contre je préviens, je suis très mauvais avec les ordi Apple!
TLDR for impatient persons:
Here you have examples of basic sfml library usage.
- levelA: simple usage and simple C++ (no class, no structures, just simple stuff)
- levelB: simple usage and less simple C++ (can use class, table arrays, structs ect…)
in levelA:
- level0:
- circle display example
- level1:
- text and shapes display example
- printing mouse click position example
- level2:
- moves an object on the click position example
- change color when mouse on object example
in levelB:
- colors a line on the clicked position example
- a color toggle button example