| Simple and Fast Multimedia Library | |
|---|---|
SFML logo | |
| Original authors | Laurent Gomila, and others |
| Developer | SFML Team |
| Initial release | August 9, 2007; 18 years ago (2007-08-09) |
| Stable release | 3.0.2 / September 18, 2025; 5 months ago (2025-09-18) |
| Written in | C++ |
| Operating system | Linux,macOS,Windows,FreeBSD |
| Type | API |
| License | zlib License[1][2] |
| Website | www |
| Repository | |
Simple and Fast Multimedia Library (SFML) is across-platform software developmentlibrary designed to provide a simpleapplication programming interface (API) to various multimedia components in computers. It is written inC++ with bindings available forAda,C,Crystal,D,Euphoria,Go,Java,Julia,.NET,Nim,OCaml,Python,Ruby,Rust,Node.js,Beef andZuko.[3] Experimental mobile ports were made available forAndroid andiOS with the release of SFML 2.2.[4]
SFML handles creating and input towindows, and creating and managingOpenGL contexts. It also provides a graphics module for simplehardware acceleration of2D computer graphics which includes text rendering usingFreeType, an audio module that usesOpenAL, replaced byminiaudio as of v3.0.0,[5] and a networking module for basicTransmission Control Protocol (TCP) andUser Datagram Protocol (UDP) communication.
SFML isfree and open-source software provided under the terms of thezlib/png license. It is available onLinux,macOS,Windows andFreeBSD.[6][7] The first version v1.0 was released on 9 August 2007, and the latest version, v3.0.0, was released on 21 December 2024.[8]
SFML consists of various modules:
While the graphics module is one of the main features of SFML, developers who are interested in only creating an environment to program directly in OpenGL can do so by using the Window module on its own without the graphics module. Similarly, the other modules can also be used independently of each other, except for the System module which is used by all of the modules.
SFML is written in C++ and provides a C++ interface (it also provides a C interface through the official CSFML binding). Severallanguage bindings exist that enable using SFML in other programming languages.[3]
This table lists supported bindings for SFML as of 2024[update].
| Name | Language | Supported version |
|---|---|---|
| ASFML | Ada | 2.6 |
| CSFML1 | C | 2.6 |
| BeefSFML | Beef | 2.5 |
| SFML.Net1 | .NET | 2.6 |
| CrSFML | Crystal | 2.6 |
| bindbc-sfml | D | 2.5 |
| DSFML | D | 2.1 |
| EuSFML2 | Euphoria | 2.4 |
| csfml-fpc | Free Pascal | 2.5 |
| go-sfml | Go | 2.5.1 |
| GoSFML2 | Go | 2.0 |
| Hackage | Haskell | 2.3 |
| JSFML | Java | 2.2 |
| CSFML.jl | Julia | 2.5.1 |
| nim-csfml | Nim | 2.3 |
| Ocsfml | OCaml | 2.2 |
| OCaml-SFML | OCaml | 2.5.1 |
| PasSFML | Pascal | 2.4 |
| pySFML | Python | 2.3.2 |
| rbSFMLArchived 2018-05-27 at theWayback Machine | Ruby | 2.3.2 |
| rust-sfml | Rust | 2.6.1 |
| zig-sfml | Zig | 2.6.1 |
| sfml.js | Node.js | 2.5.1 |
| zukoSFML | Zuko | 2.5 |
1 Official bindings
SFML provides the basic functions on whichhigher-level software can be built. Add-on libraries exist that provide added support forgraphical user interfaces (GUIs),[9][10] 2Dlighting,[11]particle systems andanimation,[12]video playback[13] andtilemaps.[14]
This is a basic example of SFML given on the tutorial page, which draws a green circle.[15]
#include<SFML/Graphics.hpp>importstd;usingsf::Color;usingsf::CircleShape;usingsf::Event;usingsf::RenderWindow;usingsf::VideoMode;intmain(){RenderWindowwindow(VideoMode({200,200}),"SFML works!");CircleShapeshape(100.0f);shape.setFillColor(Color::Green);while(window.isOpen()){while(conststd::optionalevent=window.pollEvent()){if(event->is<Event::Closed>()){window.close();}}window.clear();window.draw(shape);window.display();}}
SFML is primarily used by hobbyist game developers, smallindependent video game developers, andstartup companies consisting of several developers at most. Because SFML does not require writing large amounts of code, it has also been adopted by manyLudum Dare participants.[16] Compared to older libraries such asSimple DirectMedia Layer (SDL) andAllegro, the SFML user base is relatively small but growing. As of 25 December 2024[update], itsGitHubsoftware repository has been starred by over 10,000 users.[17]
SFML has been used in teaching at universities and in scientific projects.[18][19][20][21][22][23]
Further examples of games using SFML are listed onIndieDB.[50]