Simple and Fast Multimedia Library
Simple and Fast Multimedia Library is a cross-platform software development library designed to provide a simple application programming interface to various multimedia components in computers. It is written in C++ with
bindings available for Ada, C, Crystal, D, Euphoria, Go, Java, Julia, .NET, Nim, OCaml, Python, Ruby, Rust, Node.js, and . Experimental mobile ports were made available for Android and iOS with the release of SFML 2.2.
SFML handles creating and input to windows, and creating and managing OpenGL contexts. It also provides a graphics module for simple hardware acceleration of 2D computer graphics which includes text rendering using FreeType, an audio module that uses OpenAL, replaced by as of v3.0.0, and a networking module for basic Transmission Control Protocol and User Datagram Protocol communication.
SFML is free and open-source software provided under the terms of the zlib/png license. It is available on Linux, macOS, Windows and FreeBSD. The first version v1.0 was released on 9 August 2007, and the latest version, v3.0.0, was released on 21 December 2024.
Software architecture
Modules
SFML consists of various modules:- System – vector and Unicode string classes, portable threading and timer facilities
- Window – window and input device management including support for joysticks, OpenGL context management
- Graphics – hardware acceleration of 2D graphics including sprites, polygons and text rendering
- Audio – hardware-accelerated spatialised audio playback and recording
- Network – TCP and UDP network sockets, data encapsulation facilities, HTTP and FTP classes
Language bindings
SFML is written in C++ and provides a C++ interface. Several language bindings exist that enable using SFML in other programming languages.This table lists supported bindings for SFML as of 2024.
| Name | Language | Supported version |
| Ada | 2.6 | |
| 1 | C | 2.6 |
| 2.5 | ||
| 1 | .NET | 2.6 |
| 2.6 | ||
| D | 2.5 | |
| D | 2.1 | |
| Euphoria | 2.4 | |
| Free Pascal | 2.5 | |
| Go | 2.5.1 | |
| Go | 2.0 | |
| Haskell | 2.3 | |
| Java | 2.2 | |
| Julia | 2.5.1 | |
| Nim | 2.3 | |
| OCaml | 2.2 | |
| OCaml | 2.5.1 | |
| Pascal | 2.4 | |
| Python | 2.3.2 | |
| Ruby | 2.3.2 | |
| Rust | 2.6.1 | |
| Zig | 2.6.1 | |
| Node.js | 2.5.1 | |
| 2.5 |
1 Official bindings
Unofficial add-ons
SFML provides the basic functions on which higher-level software can be built. Add-on libraries exist that provide added support for graphical user interfaces, 2D lighting, particle systems and animation, video playback and tilemaps.Example
This is a basic example of SFML given on the tutorial page, which draws a green circle.- include
using sf::Color;
using sf::CircleShape;
using sf::Event;
using sf::RenderWindow;
using sf::VideoMode;
int main
Reception and adoption
SFML is primarily used by hobbyist game developers, small independent [video game developer]s, and startup companies consisting of several developers at most. Because SFML does not require writing large amounts of code, it has also been adopted by many Ludum Dare participants. Compared to older libraries such as Simple DirectMedia Layer and Allegro, the SFML user base is relatively small but growing., its GitHub software repository has been starred by over 10,000 users.SFML has been used in teaching at universities and in scientific projects.
Video game use examples
Atom Zombie Smasher, real-time strategy game.', Simulation Interactive Fiction game.- '
Other software use
- , open source digital signal processing library for C++.
- , a 2D C# framework built on SFML 2.
- GDevelop, open source game creation software.
- , tool to visualize detailed landscapes and architecture.
- , 2D C++ game engine for Android and PC.