SFML Documentation (SFML / Learn (original) (raw)

Welcome

Welcome to the official SFML documentation. Here you will find a detailed view of all the SFML classes and functions.
If you are looking for tutorials, you can visit the official website at www.sfml-dev.org.

Short example

Here is a short example, to show you how simple it is to use SFML:

#include <SFML/Audio.hpp>

#include <SFML/Graphics.hpp>

int main()

{

return EXIT_FAILURE;

return EXIT_FAILURE;

sf::Text text("Hello SFML", font, 50);

return EXIT_FAILURE;

while (window.isOpen())

{

while (window.pollEvent(event))

{

window.close();

}

window.clear();

window.draw(sprite);

window.draw(text);

window.display();

}

return EXIT_SUCCESS;

}

Defines a system event and its parameters.

EventType type

Type of the event.

@ Closed

The window requested to be closed (no data)

Class for loading and manipulating character fonts.

bool loadFromFile(const std::string &filename)

Load the font from a file.

Streamed music played from an audio file.

bool openFromFile(const std::string &filename)

Open a music from an audio file.

Window that can serve as a target for 2D drawing.

void play()

Start or resume playing the audio stream.

Drawable representation of a texture, with its own transformations, color, etc.

Graphical text that can be drawn to a render target.

Image living on the graphics card that can be used for drawing.

bool loadFromFile(const std::string &filename, const IntRect &area=IntRect())

Load the texture from a file on disk.

VideoMode defines a video mode (width, height, bpp)