
SFML Game Development By Example
By :

Having blocking functions in your code can be a real nuisance. Listening for incoming network connections or data, asking users to input something into the console, or even loading game data, like textures, maps, or sounds, can block a program from executing until it's done. Have you ever wondered how certain games have a loading bar that actually moves while the data is being loaded? How can that be done with code that is executed sequentially? The answer to that is multi-threading. Your application runs all its code sequentially from top to bottom in something referred to as the main thread. It is not a program, as it can't exist by itself. Instead, a thread only runs within your application. The beauty of this is that multiple threads can exist and run all at once, which enables parallel code execution. Consider the following diagram:
Let's say that the entire application space is the main thread, and all we do here is update and render the game. The example...
Change the font size
Change margin width
Change background colour