cbec344876
There were 6 copies of InputImpl.hpp for Windows, macOS, Linux, Linux DRM, iOS, and Android. All but Windows and Linux DRM were identical so there's already an easy opportunity for consolidation. The Windows header included some additional private static functions and data. An equivalent way of expressing this is via more data and functions instead the anonymous namespace of Win32/InputImpl.cpp so that's what I did. To fix some issues with functions being used before they're defined I moved number of functions into the anonymous namespace of that file which resulted in adding `sf::` in lots of places. InputImplUDev.hpp used by the DRM backend was trickier because includes WindowImplDRM as a friend. This creates a weird dependency graph where a distant class can call private functions that mutate private state. I kept the definitions of those functions inside DRM/InputImpl.cpp while moving their declaration to WindowImplDRM.cpp which is the only file where they're used. This is a bit odd but it avoids using the preprocessor and ensures that only the file that needs these functions can call them. In the end I was able to delete all 6 separate copies of InputImpl.hpp and consolidate them into src/SFML/Window/InputImpl.hpp saving nearly 1,000 lines of code. Because `sf::priv::InputImpl` is merely a set of static functions I converted this class to a simple namespace. The use of a namespace is what ultimately allowed me to untangle the DRM functions that were not present in other implementations |
||
---|---|---|
.github | ||
cmake | ||
doc | ||
examples | ||
extlibs | ||
include/SFML | ||
src/SFML | ||
test | ||
tools | ||
.clang-format | ||
.clang-tidy | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
changelog.md | ||
CMakeLists.txt | ||
CMakePresets.json | ||
CONTRIBUTING.md | ||
license.md | ||
readme.md |
SFML — Simple and Fast Multimedia Library
SFML is a simple, fast, cross-platform and object-oriented multimedia API. It provides access to windowing, graphics, audio and network. It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python.
State of Development
Development is focused on the next major version in the master
branch. No more features are planned for the 2.x release series.
- The
master
branch contains work in progress for the next major version SFML 3. As such it's considered unstable, but any testing and feedback is highly appreciated. - The
2.6.0
tag is the latest official SFML release and will be the last minor release in the 2.x series.
Download
- You can get the latest official release on SFML's website.
- You can also get the source code of the current development version from the Git repository.
- Alternatively, you can get the latest snapshot / artifact builds from the artifacts storage.
Install
Follow the instructions of the tutorials, there is one for each platform/compiler that SFML supports.
Learn
There are several places to learn SFML:
- The official tutorials
- The online API documentation
- The community wiki
Community
Here are some useful community links:
Contribute
SFML is an open-source project, and it needs your help to go on growing and improving. If you want to get involved and suggest some additional features, file a bug report or submit a patch, please have a look at the contribution guidelines.
Authors
- Laurent Gomila (laurent@sfml-dev.org)
- Marco Antognini (hiura@sfml-dev.org)
- binary1248 (binary1248@hotmail.com)
- Lukas Dürrenberger (eXpl0it3r@sfml-dev.org)
- Jonathan De Wachter (dewachter.jonathan@gmail.com)
- Jan Haller (bromeon@sfml-dev.org)
- Mario Liebisch (mario@sfml-dev.org)
- Stefan Schindler (tank@sfml-dev.org)
- Artur Moreira (artturmoreira@gmail.com)
- Vittorio Romeo (vittorioromeo@sfml-dev.org)
- Chris Thrasher (thrasher@sfml-dev.org)
- And many other members of the SFML community
License
The SFML libraries and source code are distributed under the zlib/libpng license. See license.md. External libraries used by SFML are distributed under their own licenses.
In short, SFML is free for any use (commercial or personal, proprietary or open-source). You can use SFML in your project without any restriction. You can even omit to mention that you use SFML -- although it would be appreciated.
External libraries used by SFML
- OpenAL-Soft is under the LGPL license
- stb_image and stb_image_write are public domain
- freetype is under the FreeType license or the GPL license
- libogg is under the BSD license
- libvorbis is under the BSD license
- libflac is under the BSD license
- minimp3 is under the CC0 license