<p>Welcome to the official SFML documentation. Here you will find a detailed view of all the SFML <ahref="./annotated.php">classes</a> and functions. <br/>
If you are looking for tutorials, you can visit the official website at <ahref="https://www.sfml-dev.org/">www.sfml-dev.org</a>.</p>
<h1><aclass="anchor"id="example"></a>
Short example</h1>
<p>Here is a short example, to show you how simple it is to use SFML:</p>
<divclass="fragment"><divclass="line"><spanclass="preprocessor">#include <SFML/Audio.hpp></span></div><divclass="line"><spanclass="preprocessor">#include <SFML/Graphics.hpp></span></div><divclass="line"></div><divclass="line"><spanclass="keywordtype">int</span> main()</div><divclass="line">{</div><divclass="line"><spanclass="comment">// Create the main window</span></div><divclass="line"><aclass="code"href="classsf_1_1RenderWindow.html">sf::RenderWindow</a> window(<aclass="code"href="classsf_1_1VideoMode.html">sf::VideoMode</a>(800, 600), <spanclass="stringliteral">"SFML window"</span>);</div><divclass="line"></div><divclass="line"><spanclass="comment">// Load a sprite to display</span></div><divclass="line"><aclass="code"href="classsf_1_1Texture.html">sf::Texture</a> texture;</div><divclass="line"><spanclass="keywordflow">if</span> (!texture.<aclass="code"href="classsf_1_1Texture.html#a8e1b56eabfe33e2e0e1cb03712c7fcc7">loadFromFile</a>(<spanclass="stringliteral">"cute_image.jpg"</span>))</div><divclass="line"><spanclass="keywordflow">return</span> EXIT_FAILURE;</div><divclass="line"><aclass="code"href="classsf_1_1Sprite.html">sf::Sprite</a> sprite(texture);</div><divclass="line"></div><divclass="line"><spanclass="comment">// Create a graphical text to display</span></div><divclass="line"><aclass="code"href="classsf_1_1Font.html">sf::Font</a> font;</div><divclass="line"><spanclass="keywordflow">if</span> (!font.<aclass="code"href="classsf_1_1Font.html#ab020052ef4e01f6c749a85571c0f3fd1">loadFromFile</a>(<spanclass="stringliteral">"arial.ttf"</span>))</div><divclass="line"><spanclass="keywordflow">return</span> EXIT_FAILURE;</div><divclass="line"><aclass="code"href="classsf_1_1Text.html">sf::Text</a> text(<spanclass="stringliteral">"Hello SFML"</span>, font, 50);</div><divclass="line"></div><divclass="line"><spanclass="comment">// Load a music to play</span></div><divclass="line"><aclass="code"href="classsf_1_1Music.html">sf::Music</a> music;</div><divclass="line"><spanclass="keywordflow">if</span> (!music.<aclass="code"href="classsf_1_1Music.html#a3edc66e5f5b3f11e84b90eaec9c7d7c0">openFromFile</a>(<spanclass="stringliteral">"nice_music.ogg"</span>))</div><divclass="line"><spanclass="keywordflow">return</span> EXIT_FAILURE;</div><divclass="line"></div><divclass="line"><spanclass="comment">// Play the music</span></div><divclass="line"> music.<aclass="code"href="classsf_1_1SoundStream.html#afdc08b69cab5f243d9324940a85a1144">play</a>();</div><divclass="line"></div><divclass="line"><spanclass="comment">// Start the game loop</span></div><divclass="line"><spanclass="keywordflow">while</span> (window.<aclass="code"href="classsf_1_1Window.html#ae873503db7d48157bb9cbf6129562bce">isOpen</a>())</div><divclass="line"> {</div><divclass="line"><spanclass="comment">// Process events</span></div><divclass="line"><aclass="code"href="classsf_1_1Event.html">sf::Event</a> event;</div><divclass="line"><spanclass="keywordflow">while</span> (window.<aclass="code"href="classsf_1_1Window.html#a338e996585faf82e93069858e3b531b7">pollEvent</a>(event))</div><divclass="line"> {</div><divclass="line"><spanclass="comment">// Close window: exit</span></div><divclass="line"><spanclass="keywordflow">if</span> (event.<aclass="code"href="classsf_1_1Event.html#adf2f8044f713fd9d6019077b0d1ffe0a">type</a> == <aclass="code"href="classsf_1_1Event.html#af41fa9ed45c02449030699f671331d4aa316e4212e083f1dce79efd8d9e9c0a95">sf::Event::Closed</a>)</div><divclass="line"> window.<aclass="code"href="classsf_1_1Window.html#a99d1e030387b0c26f5995670504fe7b5">close</a>();</div><divclass="line"> }</div><divclass="line"></div><divclass="line"><spanclass="comment">// Clear screen</span></div><divclass="line"> window.<aclass="code"