JSFML is the official Java binding to SFML, a Java library that provides Java applications with access to a wide range of the functionalities of SFML.
Java has been missing a simple, straightforward, but at the same time efficient multimedia library. It is the goal of JSFML to provide such a library for Java developers by taking advantage of the straightforward design and blazing performance of SFML.
What JSFML is and is notJSFML is a Java binding to SFML. It is
not Java re-implementation of SFML. This makes JSFML relatively easy to maintain and ensures that it can be updated to the latest SFML release, including all new features and bugfixes, in a minimal amount of time.
FeaturesJSFML focuses on bindings to the
Graphics,
Audio and
Input features of SFML as well as all related helper and utility types. Features like multi-threading, networking and unicode support, which Java provides out of the box, are not considered.
Planned features include integration of SFML RenderWindows into AWT / Swing applications, which would also allow the use of SFML in browser applets.
JSFML works on Windows and Linux systems (Mac OS X is planned as well!). The "self-contained" package includes automatic extraction of the platform-specific binaries from the jar file into the user's home directory. This way, developers will not have to bother with packaging JSFML properly, but can simply redistribute the JSFML library as one single jar file.
ConventionsSince JSFML is a binding to SFML, the API will be layed out similarly. However, some things done in C++ are not possible in Java. This includes const references and operator overloading. JSFML follows the following principles:
- Overloaded operators for SFML objects are represented by appropriately named static methods within the class in question.
- Objects passed to JSFML methods are never modified by those unless it is explicitly mentioned in the documentation.
- Objects retrieved from SFML that should not be altered, such as the default font or a render texture's texture object, are of an invisible immutable subtype and reject any change attempts silently.
- A range of method parameters is marked as @NotNull. If null is passed for these parameters, JSFML will throw an IllegalArgumentException.
For a seamless Java integration, the following conventions intentionally differ from those of SFML:
- camelBack naming convention for methods, ALL_CAPS naming convention for enum values and constants.
- Instead of returning a success value (true or false) when resources are loaded, JSFML throws exceptions if something goes wrong.
Source codeJSFML's source code is available from its Github repository:
https://github.com/pdinklag/JSFMLPlease refer to the notes found there in case you want to build JSFML.
Requests, ideas, bugs and other issuesFeel free to post these in this forum, but also consider getting a Github account and post them in the
Issue Tracker for better organization!
TutorialsOn the Github wiki:
https://github.com/pdinklag/JSFML/wikiJavadocA Javadoc for JSFML can be found at:
http://jsfml.org/javadoc/ReleasesThere are no releases of JSFML just yet, but stay tuned to this forum for test pre-releases!
JSFML is set for a first official release not long after the official release of SFML 2.0.