Sophie

Sophie

distrib > Mandriva > 2010.2 > i586 > media > contrib-backports > by-pkgid > f00c83953c7eb23ee3c18f4f35d8eb6b > files > 207

sfml2-doc-2.0-0.1mdv2010.2.noarch.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.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.htm"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.htm"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.htm"><span>Classes</span></a></li>
      <li><a href="files.htm"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.htm"><span>Class&nbsp;List</span></a></li>
      <li><a href="classes.htm"><span>Class&nbsp;Index</span></a></li>
      <li><a href="hierarchy.htm"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.htm"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><b>sf</b>::<a class="el" href="classsf_1_1Mouse.htm">Mouse</a>
  </div>
</div>
<div class="contents">
<h1>sf::Mouse Class Reference<br/>
<small>
[<a class="el" href="group__window.htm">Window module</a>]</small>
</h1><!-- doxytag: class="sf::Mouse" -->
<p>Give access to the real-time state of the mouse.  
<a href="#_details">More...</a></p>

<p><code>#include &lt;<a class="el" href="Mouse_8hpp_source.htm">Mouse.hpp</a>&gt;</code></p>

<p><a href="classsf_1_1Mouse-members.htm">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">enum &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90">Button</a> { <br/>
&nbsp;&nbsp;<a class="el" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90a8bb4856e1ec7f6b6a8605effdfc0eee8">Left</a>, 
<br/>
&nbsp;&nbsp;<a class="el" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90af2cff24ab6c26daf079b11189f982fc4">Right</a>, 
<br/>
&nbsp;&nbsp;<a class="el" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90a2c353189c4b11cf216d7caddafcc609d">Middle</a>, 
<br/>
&nbsp;&nbsp;<a class="el" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90aecc7f3ce9ad6a60b9b0027876446b8d7">XButton1</a>, 
<br/>
&nbsp;&nbsp;<a class="el" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90a03fa056fd0dd9d629c205d91a8ef1b5a">XButton2</a>, 
<br/>
&nbsp;&nbsp;<a class="el" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90a52a1d434289774240ddaa22496762402">ButtonCount</a>
<br/>
 }</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight"><p><a class="el" href="classsf_1_1Mouse.htm" title="Give access to the real-time state of the mouse.">Mouse</a> buttons. </p>
 <a href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90">More...</a><br/></td></tr>
<tr><td colspan="2"><h2>Static Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Mouse.htm#a367e974948b76a97db0fcd13f0a5db3c">IsButtonPressed</a> (<a class="el" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90">Button</a> button)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Check if a mouse button is pressed.  <a href="#a367e974948b76a97db0fcd13f0a5db3c"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classsf_1_1Vector2.htm">Vector2i</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Mouse.htm#af5c2c1f1e632fd503bd1717b00b5565f">GetPosition</a> ()</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the current position of the mouse in desktop coordinates.  <a href="#af5c2c1f1e632fd503bd1717b00b5565f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classsf_1_1Vector2.htm">Vector2i</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Mouse.htm#ac48d527ca5b712252d80a9a991f5a582">GetPosition</a> (const <a class="el" href="classsf_1_1Window.htm">Window</a> &amp;relativeTo)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get the current position of the mouse in window coordinates.  <a href="#ac48d527ca5b712252d80a9a991f5a582"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Mouse.htm#a851756fdc0430186d5cc3900e63283db">SetPosition</a> (const <a class="el" href="classsf_1_1Vector2.htm">Vector2i</a> &amp;position)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the current position of the mouse in desktop coordinates.  <a href="#a851756fdc0430186d5cc3900e63283db"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">static void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classsf_1_1Mouse.htm#a6677a5b6e63852250d3aff119435546e">SetPosition</a> (const <a class="el" href="classsf_1_1Vector2.htm">Vector2i</a> &amp;position, const <a class="el" href="classsf_1_1Window.htm">Window</a> &amp;relativeTo)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Set the current position of the mouse in window coordinates.  <a href="#a6677a5b6e63852250d3aff119435546e"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Give access to the real-time state of the mouse. </p>
<p><a class="el" href="classsf_1_1Mouse.htm" title="Give access to the real-time state of the mouse.">sf::Mouse</a> provides an interface to the state of the mouse.</p>
<p>It only contains static functions (a single mouse is assumed), so it's not meant to be instanciated.</p>
<p>This class allows users to query the mouse state at any time and directly, without having to deal with a window and its events. Compared to the MouseMoved, MouseButtonPressed and MouseButtonReleased events, <a class="el" href="classsf_1_1Mouse.htm" title="Give access to the real-time state of the mouse.">sf::Mouse</a> can retrieve the state of the cursor and the buttons at any time (you don't need to store and update a boolean on your side in order to know if a button is pressed or released), and you always get the real state of the mouse, even if it is moved, pressed or released when your window is out of focus and no event is triggered.</p>
<p>The SetPosition and GetPosition functions can be used to change or retrieve the current position of the mouse pointer. There are two versions: one that operates in global coordinates (relative to the desktop) and one that operates in window coordinates (relative to a specific window).</p>
<p>Usage example: </p>
<div class="fragment"><pre class="fragment"> <span class="keywordflow">if</span> (<a class="code" href="classsf_1_1Mouse.htm#a367e974948b76a97db0fcd13f0a5db3c" title="Check if a mouse button is pressed.">sf::Mouse::IsButtonPressed</a>(<a class="code" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90a8bb4856e1ec7f6b6a8605effdfc0eee8" title="The left mouse button.">sf::Mouse::Left</a>))
 {
     <span class="comment">// left click...</span>
 }

 <span class="comment">// get global mouse position</span>
 <a class="code" href="classsf_1_1Vector2.htm" title="Utility template class for manipulating 2-dimensional vectors.">sf::Vector2i</a> position = <a class="code" href="classsf_1_1Mouse.htm#af5c2c1f1e632fd503bd1717b00b5565f" title="Get the current position of the mouse in desktop coordinates.">sf::Mouse::GetPosition</a>();

 <span class="comment">// set mouse position relative to a window</span>
 <a class="code" href="classsf_1_1Mouse.htm#a851756fdc0430186d5cc3900e63283db" title="Set the current position of the mouse in desktop coordinates.">sf::Mouse::SetPosition</a>(<a class="code" href="classsf_1_1Vector2.htm" title="Utility template class for manipulating 2-dimensional vectors.">sf::Vector2i</a>(100, 200), window);
</pre></div><dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classsf_1_1Joystick.htm" title="Give access to the real-time state of the joysticks.">sf::Joystick</a>, <a class="el" href="classsf_1_1Keyboard.htm" title="Give access to the real-time state of the keyboard.">sf::Keyboard</a> </dd></dl>

<p>Definition at line <a class="el" href="Mouse_8hpp_source.htm#l00043">43</a> of file <a class="el" href="Mouse_8hpp_source.htm">Mouse.hpp</a>.</p>
<hr/><h2>Member Enumeration Documentation</h2>
<a class="anchor" id="a4fb128be433f9aafe66bc0c605daaa90"></a><!-- doxytag: member="sf::Mouse::Button" ref="a4fb128be433f9aafe66bc0c605daaa90" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90">sf::Mouse::Button</a></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p><a class="el" href="classsf_1_1Mouse.htm" title="Give access to the real-time state of the mouse.">Mouse</a> buttons. </p>
<dl><dt><b>Enumerator: </b></dt><dd><table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"><em><a class="anchor" id="a4fb128be433f9aafe66bc0c605daaa90a8bb4856e1ec7f6b6a8605effdfc0eee8"></a><!-- doxytag: member="Left" ref="a4fb128be433f9aafe66bc0c605daaa90a8bb4856e1ec7f6b6a8605effdfc0eee8" args="" -->Left</em>&nbsp;</td><td>
<p>The left mouse button. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a4fb128be433f9aafe66bc0c605daaa90af2cff24ab6c26daf079b11189f982fc4"></a><!-- doxytag: member="Right" ref="a4fb128be433f9aafe66bc0c605daaa90af2cff24ab6c26daf079b11189f982fc4" args="" -->Right</em>&nbsp;</td><td>
<p>The right mouse button. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a4fb128be433f9aafe66bc0c605daaa90a2c353189c4b11cf216d7caddafcc609d"></a><!-- doxytag: member="Middle" ref="a4fb128be433f9aafe66bc0c605daaa90a2c353189c4b11cf216d7caddafcc609d" args="" -->Middle</em>&nbsp;</td><td>
<p>The middle (wheel) mouse button. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a4fb128be433f9aafe66bc0c605daaa90aecc7f3ce9ad6a60b9b0027876446b8d7"></a><!-- doxytag: member="XButton1" ref="a4fb128be433f9aafe66bc0c605daaa90aecc7f3ce9ad6a60b9b0027876446b8d7" args="" -->XButton1</em>&nbsp;</td><td>
<p>The first extra mouse button. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a4fb128be433f9aafe66bc0c605daaa90a03fa056fd0dd9d629c205d91a8ef1b5a"></a><!-- doxytag: member="XButton2" ref="a4fb128be433f9aafe66bc0c605daaa90a03fa056fd0dd9d629c205d91a8ef1b5a" args="" -->XButton2</em>&nbsp;</td><td>
<p>The second extra mouse button. </p>
</td></tr>
<tr><td valign="top"><em><a class="anchor" id="a4fb128be433f9aafe66bc0c605daaa90a52a1d434289774240ddaa22496762402"></a><!-- doxytag: member="ButtonCount" ref="a4fb128be433f9aafe66bc0c605daaa90a52a1d434289774240ddaa22496762402" args="" -->ButtonCount</em>&nbsp;</td><td>
<p>Keep last -- the total number of mouse buttons. </p>
</td></tr>
</table>
</dd>
</dl>

<p>Definition at line <a class="el" href="Mouse_8hpp_source.htm#l00051">51</a> of file <a class="el" href="Mouse_8hpp_source.htm">Mouse.hpp</a>.</p>

</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="ac48d527ca5b712252d80a9a991f5a582"></a><!-- doxytag: member="sf::Mouse::GetPosition" ref="ac48d527ca5b712252d80a9a991f5a582" args="(const Window &amp;relativeTo)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classsf_1_1Vector2.htm">Vector2i</a> sf::Mouse::GetPosition </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsf_1_1Window.htm">Window</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>relativeTo</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the current position of the mouse in window coordinates. </p>
<p>This function returns the current position of the mouse cursor, relative to the given window.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>relativeTo</em>&nbsp;</td><td>Reference window</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>Current position of the mouse </dd></dl>

</div>
</div>
<a class="anchor" id="af5c2c1f1e632fd503bd1717b00b5565f"></a><!-- doxytag: member="sf::Mouse::GetPosition" ref="af5c2c1f1e632fd503bd1717b00b5565f" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static <a class="el" href="classsf_1_1Vector2.htm">Vector2i</a> sf::Mouse::GetPosition </td>
          <td>(</td>
          <td class="paramname"></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Get the current position of the mouse in desktop coordinates. </p>
<p>This function returns the global position of the mouse cursor on the desktop.</p>
<dl class="return"><dt><b>Returns:</b></dt><dd>Current position of the mouse </dd></dl>

</div>
</div>
<a class="anchor" id="a367e974948b76a97db0fcd13f0a5db3c"></a><!-- doxytag: member="sf::Mouse::IsButtonPressed" ref="a367e974948b76a97db0fcd13f0a5db3c" args="(Button button)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static bool sf::Mouse::IsButtonPressed </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classsf_1_1Mouse.htm#a4fb128be433f9aafe66bc0c605daaa90">Button</a>&nbsp;</td>
          <td class="paramname"> <em>button</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Check if a mouse button is pressed. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>button</em>&nbsp;</td><td>Button to check</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>True if the button is pressed, false otherwise </dd></dl>

</div>
</div>
<a class="anchor" id="a6677a5b6e63852250d3aff119435546e"></a><!-- doxytag: member="sf::Mouse::SetPosition" ref="a6677a5b6e63852250d3aff119435546e" args="(const Vector2i &amp;position, const Window &amp;relativeTo)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static void sf::Mouse::SetPosition </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsf_1_1Vector2.htm">Vector2i</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>position</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="classsf_1_1Window.htm">Window</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>relativeTo</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the current position of the mouse in window coordinates. </p>
<p>This function sets the current position of the mouse cursor, relative to the given window.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>position</em>&nbsp;</td><td>New position of the mouse </td></tr>
    <tr><td valign="top"></td><td valign="top"><em>relativeTo</em>&nbsp;</td><td>Reference window </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a class="anchor" id="a851756fdc0430186d5cc3900e63283db"></a><!-- doxytag: member="sf::Mouse::SetPosition" ref="a851756fdc0430186d5cc3900e63283db" args="(const Vector2i &amp;position)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">static void sf::Mouse::SetPosition </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="classsf_1_1Vector2.htm">Vector2i</a> &amp;&nbsp;</td>
          <td class="paramname"> <em>position</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [static]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Set the current position of the mouse in desktop coordinates. </p>
<p>This function sets the global position of the mouse cursor on the desktop.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>position</em>&nbsp;</td><td>New position of the mouse </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="Mouse_8hpp_source.htm">Mouse.hpp</a></li>
</ul>
</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>