SFML Modules

Learn about the 5 SFML Modules

The 5 SFML Modules

If you have read the tutorial Graphics Window, you know about the SFML Graphics Module. There are 4 other modules that together with the Graphics Module, form the SFML Library. One of those modules (The System Module) is independent and can be used alone while the others depend on one or two other modules.

  • The System Module
  • The Window Module (depends on System)
  • The Graphics Module (depends on Window, which depends on System)
  • The Audio Module (depends on System)
  • The Network Module (depends on System)

The System Module

The System module provides basic classes like 

  • sf::Vector2 and sf::Vector3 : classes that represent coordinate in 2D (x,y) and 3D (x, y, z)
  • sf::Time : a class to store time in seconds, milliseconds, or microseconds
  • sf::Clock : a timer class to measure the time that passes
  • sf::String : SFML own implementation of std::string
  • sf::NonCopyable : a class that disables derived classes copy constructor and assignment operator, forcing the derived classes to only have one instance at a time
  • sf::Thread and sf::Mutex : classes to create and handle threads

The complete list of the System Module headers can be found here : System Module Headers

The Window Module

The Window module  provides the following features :

  • Create a window with the class sf::Window
  • Capture all sort of user inputs (Keyboard, Mouse, Joystick, Touch, and Sensor for phone devices)
  • Store and Retrieve data in the Clipboard : When you copy a text with CTRL + C or Mouse right-click then copy, the data goes into the Clipboard
  • Customize the mouse cursor

The complete list of the Window Module headers can be found here : Window Module Headers

The Graphics Module

This module is the reason why SFML is so simple to use for creating games. The module is created on top of the System module and the Window module and offers a very simple interface to handle Shapes, Images, Texts and Window views (camera). This module provides the following things:

  • Create a window with the class sf::RenderWindow
  • Create simple and complex shapes like Circle, Rectangle, and Convex Polygons. 
  • Load Images then create Textures and Sprites
  • Load fonts then create Texts
  • Manipulate Shapes, Sprites, and Text properties : Position, Rotation, Scale, Color
  • Manage window views (Cameras)
  • Load and use OpenGL Shaders
  • Render on Textures

The complete list of the Graphics Module headers can be found here : Graphics Module Headers

The Audio Module

The Audio module allows you to play sound effects and music of different formats (WAV, OGG/Vorbis, and FLAC). It also allows you to record sounds coming from your microphone. The module contains the following classes :

  • sf::Sound and sf::SoundBuffer : classes used to load and play sound effects (very short sounds)
  • sf::Music :  a class used to play music (relatively long sounds)
  • sf::Listener : a class used to position a virtual listener in your game scene created a special effect.
  • sf::SoundBufferRecorder  : a class used to record sounds from your microphone.

The complete list of the Audio Module headers can be found here : Audio Module Headers

The Network Module

The Network module provides multiple ways of communicating through the internet using the following protocols :

  • TCP (Transmission Control Protocol) : a protocol that offers reliable packets transmission.
  • UDP (User Datagram Protocol) : a protocol that offers unreliable packets transmission.
  • HTTP (Hypertext Transfer Protocol) : a protocol used to communicate with Web Servers
  • FTP (File Transfer Protocol) : a protocol used upload or download file on the internet

The complete list of the Network Module headers can be found here : Network Module Headers

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

Nero Games will use the information you provide on this form to be in touch with you and to provide updates and marketing.