Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > ed1483a4d9709d82850bb84cf25535e7 > files > 392

sfml-1.5-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>SFML - Simple and Fast Multimedia Library</title>
        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="tabs.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div id="logo">
            <img src="./logo.jpg" width="770" height="200" title="SFML home" alt="SFML logo" />
        </div>
<!-- Generated by Doxygen 1.5.8 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li class="current"><a href="index.htm"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.htm"><span>Namespaces</span></a></li>
      <li><a href="annotated.htm"><span>Classes</span></a></li>
      <li><a href="files.htm"><span>Files</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>SFML Documentation</h1>
<p>
<h2><a class="anchor" name="welcome">
Welcome</a></h2>
Welcome to the official SFML documentation. Here you will find a detailed view of all the SFML <a href="./annotated.htm">classes</a>, as well as source <a href="./files.htm">files</a>. <br>
 If you are looking for tutorials, you can visit the official website at <a href="http://www.sfml-dev.org/tutorials/">www.sfml-dev.org</a>.<h2><a class="anchor" name="example">
Short example</a></h2>
Here is a short example, to show you how simple it is to use SFML :<p>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #include &lt;SFML/Audio.hpp&gt;</span>
<span class="preprocessor"> #include &lt;SFML/Graphics.hpp&gt;</span>
 
 <span class="keywordtype">int</span> main()
 {
     <span class="comment">// Create the main window</span>
     <a class="code" href="classsf_1_1RenderWindow.htm" title="Simple wrapper for sf::Window that allows easy 2D rendering.">sf::RenderWindow</a> App(<a class="code" href="classsf_1_1VideoMode.htm" title="VideoMode defines a video mode (width, height, bpp, frequency) and provides static...">sf::VideoMode</a>(800, 600), <span class="stringliteral">"SFML window"</span>);
 
     <span class="comment">// Load a sprite to display</span>
     <a class="code" href="classsf_1_1Image.htm" title="Image is the low-level class for loading and manipulating images.">sf::Image</a> Image;
     <span class="keywordflow">if</span> (!Image.<a class="code" href="classsf_1_1Image.htm#7cf6316aa5d022e0bdd95f1e79c9f50b" title="Load the image from a file.">LoadFromFile</a>(<span class="stringliteral">"cute_image.jpg"</span>))
         <span class="keywordflow">return</span> EXIT_FAILURE;
     <a class="code" href="classsf_1_1Sprite.htm" title="Sprite defines a sprite : texture, transformations, color, and draw on screen.">sf::Sprite</a> Sprite(Image);
 
     <span class="comment">// Create a graphical string to display</span>
     <a class="code" href="classsf_1_1Font.htm" title="Font is the low-level class for loading and manipulating character fonts.">sf::Font</a> Arial;
     <span class="keywordflow">if</span> (!Arial.<a class="code" href="classsf_1_1Font.htm#c1f0de973bdb9485b5f0bf4aacb717e5" title="Load the font from a file.">LoadFromFile</a>(<span class="stringliteral">"arial.ttf"</span>))
         <span class="keywordflow">return</span> EXIT_FAILURE;
     <a class="code" href="classsf_1_1String.htm" title="String defines a graphical 2D text, that can be drawn on screen.">sf::String</a> Text(<span class="stringliteral">"Hello SFML"</span>, Arial, 50);
 
     <span class="comment">// Load a music to play</span>
     <a class="code" href="classsf_1_1Music.htm" title="Music defines a big sound played using streaming, so usually what we call a music...">sf::Music</a> Music;
     <span class="keywordflow">if</span> (!Music.<a class="code" href="classsf_1_1Music.htm#26986766bc5674a87da1bcb10bef59db" title="Open a music file (doesn&amp;#39;t play it -- call Play() for that).">OpenFromFile</a>(<span class="stringliteral">"nice_music.ogg"</span>))
         <span class="keywordflow">return</span> EXIT_FAILURE;

     <span class="comment">// Play the music</span>
     Music.<a class="code" href="classsf_1_1SoundStream.htm#4d8437ef9a952fe3798bd239ff20d9bf" title="Start playing the audio stream.">Play</a>();
 
     <span class="comment">// Start the game loop</span>
     <span class="keywordflow">while</span> (App.IsOpened())
     {
         <span class="comment">// Process events</span>
         <a class="code" href="classsf_1_1Event.htm" title="Event defines a system event and its parameters.">sf::Event</a> Event;
         <span class="keywordflow">while</span> (App.GetEvent(Event))
         {
             <span class="comment">// Close window : exit</span>
             <span class="keywordflow">if</span> (Event.<a class="code" href="classsf_1_1Event.htm#90d5da29dd2f49d13dc10e7a402c0b65" title="Type of the event.">Type</a> == sf::Event::Closed)
                 App.Close();
         }
 
         <span class="comment">// Clear screen</span>
         App.Clear();
 
         <span class="comment">// Draw the sprite</span>
         App.Draw(Sprite);
 
         <span class="comment">// Draw the string</span>
         App.Draw(Text);
 
         <span class="comment">// Update the window</span>
         App.Display();
     }
 
     <span class="keywordflow">return</span> EXIT_SUCCESS;
 }
</pre></div> </div>

        <p id="footer">
            &nbsp;::&nbsp; Copyright &copy; 2007-2008 Laurent Gomila, all rights reserved &nbsp;::&nbsp;
            Documentation generated by <a href="http://www.doxygen.org/" title="doxygen website">doxygen 1.5.2</a> &nbsp;::&nbsp;
        </p>

    </body>
</html>