SFML
Original author(s) | Laurent Gomila, and others |
---|---|
Stable release | 2.1 / July 27, 2013 |
Written in | C++ |
Operating system | Cross-platform |
Type | API library |
License | zlib License[1][2] |
Website | www.sfml-dev.org |
SFML (Simple and Fast Multimedia Library) is a portable and easy-to-use API for multimedia programming. It is written in C++ with bindings available for C, D, Python, Ruby, OCaml, .Net and Go. It can be thought of as an object oriented alternative to SDL.
SFML provides hardware accelerated 2D graphics using OpenGL, supports OpenGL windowing and provides different modules that ease multimedia and game programming. SFML site offers complete SDK bundle in single pack, and tutorials to ease the developers. SFML Source code is provided under the terms of the zlib/png license.
Modules
The modules currently available are:
- The System module manages the clock and threads.
- The Window module manages windows and user interactions.
- The Graphics module makes it easy to display simple shapes and images.
- The Audio module provides an interface to handle sounds and music.
- The Network module handles sockets in a portable way.
All the modules can be used independently, except the Graphics module that depends on the Window module, and all the modules that depend on the System module.
Hello World
The program below provides a short overview of the SFML. This code just opens a window and fills it with blue:
#include <SFML/Graphics.hpp> int main() { // Create the main window sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Hello World - SFML"); // Start the main loop while (App.isOpen()) { // Process events sf::Event Event; while (App.pollEvent(Event)) { // Close window : exit if (Event.type == sf::Event::Closed) App.close(); } // Clear screen, and fill it with blue App.clear(sf::Color(0x00, 0x00, 0xff)); // Display the content of the window on screen App.display(); } return 0; }
Supported languages
The library's primarily supported language is C++, however there are bindings for SFML in other programming languages:
Official bindings
External bindings
- Python : 2.0
- D : 1.6 (Derelict 2) and 2.0 (Derelict 3)
- Ruby : RC-2.0
- OCaml : 1.6 and RC-2.0
- Java : 2.1
- Rust : 2.1
The number indicates the version for which the bindings are available:
Version History
- 1.0 (July 2007)
- 1.1 (18 September 2007)
- 1.2 (16 January 2008)
- 1.3 (22 June 2008)
- 1.4 (7 January 2009)
- 1.5 (4 June 2009)
- 1.6 (6 April 2010) : Mainly a bug-fix release
- 2.0 (29 April 2013)
- 2.1 (27 July 2013)
See also
References
External links
- Official website
- Simple and Fast Multimedia Library repository at GitHub