54 lines
7.5 KiB
HTML
54 lines
7.5 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<title>SFML - Simple and Fast Multimedia Library</title>
|
|
<meta http-equiv="Content-Type" content="text/html;"/>
|
|
<meta charset="utf-8"/>
|
|
<!--<link rel='stylesheet' type='text/css' href="https://fonts.googleapis.com/css?family=Ubuntu:400,700,400italic"/>-->
|
|
<link rel="stylesheet" type="text/css" href="doxygen.css" title="default" media="screen,print" />
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="banner-container">
|
|
<div id="banner">
|
|
<span id="sfml">SFML 2.5.1</span>
|
|
</div>
|
|
</div>
|
|
<div id="content">
|
|
<!-- Generated by Doxygen 1.8.14 -->
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li class="current"><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li><a href="modules.html"><span>Modules</span></a></li>
|
|
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
|
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<div class="title">SFML Documentation</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="textblock"><h1><a class="anchor" id="welcome"></a>
|
|
Welcome</h1>
|
|
<p>Welcome to the official SFML documentation. Here you will find a detailed view of all the SFML <a href="./annotated.php">classes</a> and functions. <br />
|
|
If you are looking for tutorials, you can visit the official website at <a href="https://www.sfml-dev.org/">www.sfml-dev.org</a>.</p>
|
|
<h1><a class="anchor" id="example"></a>
|
|
Short example</h1>
|
|
<p>Here is a short example, to show you how simple it is to use SFML:</p>
|
|
<div class="fragment"><div class="line"><span class="preprocessor">#include <SFML/Audio.hpp></span></div><div class="line"><span class="preprocessor">#include <SFML/Graphics.hpp></span></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main()</div><div class="line">{</div><div class="line"> <span class="comment">// Create the main window</span></div><div class="line"> <a class="code" href="classsf_1_1RenderWindow.html">sf::RenderWindow</a> window(<a class="code" href="classsf_1_1VideoMode.html">sf::VideoMode</a>(800, 600), <span class="stringliteral">"SFML window"</span>);</div><div class="line"></div><div class="line"> <span class="comment">// Load a sprite to display</span></div><div class="line"> <a class="code" href="classsf_1_1Texture.html">sf::Texture</a> texture;</div><div class="line"> <span class="keywordflow">if</span> (!texture.<a class="code" href="classsf_1_1Texture.html#a8e1b56eabfe33e2e0e1cb03712c7fcc7">loadFromFile</a>(<span class="stringliteral">"cute_image.jpg"</span>))</div><div class="line"> <span class="keywordflow">return</span> EXIT_FAILURE;</div><div class="line"> <a class="code" href="classsf_1_1Sprite.html">sf::Sprite</a> sprite(texture);</div><div class="line"></div><div class="line"> <span class="comment">// Create a graphical text to display</span></div><div class="line"> <a class="code" href="classsf_1_1Font.html">sf::Font</a> font;</div><div class="line"> <span class="keywordflow">if</span> (!font.<a class="code" href="classsf_1_1Font.html#ab020052ef4e01f6c749a85571c0f3fd1">loadFromFile</a>(<span class="stringliteral">"arial.ttf"</span>))</div><div class="line"> <span class="keywordflow">return</span> EXIT_FAILURE;</div><div class="line"> <a class="code" href="classsf_1_1Text.html">sf::Text</a> text(<span class="stringliteral">"Hello SFML"</span>, font, 50);</div><div class="line"></div><div class="line"> <span class="comment">// Load a music to play</span></div><div class="line"> <a class="code" href="classsf_1_1Music.html">sf::Music</a> music;</div><div class="line"> <span class="keywordflow">if</span> (!music.<a class="code" href="classsf_1_1Music.html#a3edc66e5f5b3f11e84b90eaec9c7d7c0">openFromFile</a>(<span class="stringliteral">"nice_music.ogg"</span>))</div><div class="line"> <span class="keywordflow">return</span> EXIT_FAILURE;</div><div class="line"></div><div class="line"> <span class="comment">// Play the music</span></div><div class="line"> music.<a class="code" href="classsf_1_1SoundStream.html#afdc08b69cab5f243d9324940a85a1144">play</a>();</div><div class="line"></div><div class="line"> <span class="comment">// Start the game loop</span></div><div class="line"> <span class="keywordflow">while</span> (window.<a class="code" href="classsf_1_1Window.html#ae873503db7d48157bb9cbf6129562bce">isOpen</a>())</div><div class="line"> {</div><div class="line"> <span class="comment">// Process events</span></div><div class="line"> <a class="code" href="classsf_1_1Event.html">sf::Event</a> event;</div><div class="line"> <span class="keywordflow">while</span> (window.<a class="code" href="classsf_1_1Window.html#a338e996585faf82e93069858e3b531b7">pollEvent</a>(event))</div><div class="line"> {</div><div class="line"> <span class="comment">// Close window: exit</span></div><div class="line"> <span class="keywordflow">if</span> (event.<a class="code" href="classsf_1_1Event.html#adf2f8044f713fd9d6019077b0d1ffe0a">type</a> == <a class="code" href="classsf_1_1Event.html#af41fa9ed45c02449030699f671331d4aa316e4212e083f1dce79efd8d9e9c0a95">sf::Event::Closed</a>)</div><div class="line"> window.<a class="code" href="classsf_1_1Window.html#a99d1e030387b0c26f5995670504fe7b5">close</a>();</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="comment">// Clear screen</span></div><div class="line"> window.<a class="code" href="classsf_1_1RenderTarget.html#a6bb6f0ba348f2b1e2f46114aeaf60f26">clear</a>();</div><div class="line"></div><div class="line"> <span class="comment">// Draw the sprite</span></div><div class="line"> window.<a class="code" href="classsf_1_1RenderTarget.html#a12417a3bcc245c41d957b29583556f39">draw</a>(sprite);</div><div class="line"></div><div class="line"> <span class="comment">// Draw the string</span></div><div class="line"> window.<a class="code" href="classsf_1_1RenderTarget.html#a12417a3bcc245c41d957b29583556f39">draw</a>(text);</div><div class="line"></div><div class="line"> <span class="comment">// ServerUpdate the window</span></div><div class="line"> window.<a class="code" href="classsf_1_1Window.html#adabf839cb103ac96cfc82f781638772a">display</a>();</div><div class="line"> }</div><div class="line"></div><div class="line"> <span class="keywordflow">return</span> EXIT_SUCCESS;</div><div class="line">}</div></div><!-- fragment --> </div></div><!-- contents -->
|
|
</div>
|
|
<div id="footer-container">
|
|
<div id="footer">
|
|
SFML is licensed under the terms and conditions of the <a href="https://www.sfml-dev.org/license.php">zlib/png license</a>.<br>
|
|
Copyright © Laurent Gomila ::
|
|
Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen</a> ::
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|