<trclass="memdesc:aee00dd432eacd8369d279b47c3ab4cc5"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Constants related to joysticks capabilities. <ahref="classsf_1_1Joystick.html#aee00dd432eacd8369d279b47c3ab4cc5">More...</a><br/></td></tr>
<trclass="memitem:ac7d4e1923e9f9420174f26703ea63d6c"><tdclass="memItemLeft"align="right"valign="top">static bool </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classsf_1_1Joystick.html#ac7d4e1923e9f9420174f26703ea63d6c">isConnected</a> (unsigned int joystick)</td></tr>
<trclass="memdesc:ac7d4e1923e9f9420174f26703ea63d6c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Check if a joystick is connected. <ahref="#ac7d4e1923e9f9420174f26703ea63d6c">More...</a><br/></td></tr>
<trclass="memitem:a4de9f445c6582bfe9f0873f695682885"><tdclass="memItemLeft"align="right"valign="top">static unsigned int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classsf_1_1Joystick.html#a4de9f445c6582bfe9f0873f695682885">getButtonCount</a> (unsigned int joystick)</td></tr>
<trclass="memdesc:a4de9f445c6582bfe9f0873f695682885"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Return the number of buttons supported by a joystick. <ahref="#a4de9f445c6582bfe9f0873f695682885">More...</a><br/></td></tr>
<trclass="memitem:a268e8f2a11ae6af4a47c727cb4ab4d95"><tdclass="memItemLeft"align="right"valign="top">static bool </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classsf_1_1Joystick.html#a268e8f2a11ae6af4a47c727cb4ab4d95">hasAxis</a> (unsigned int joystick, <aclass="el"href="classsf_1_1Joystick.html#a48db337092c2e263774f94de6d50baa7">Axis</a> axis)</td></tr>
<trclass="memdesc:a268e8f2a11ae6af4a47c727cb4ab4d95"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Check if a joystick supports a given axis. <ahref="#a268e8f2a11ae6af4a47c727cb4ab4d95">More...</a><br/></td></tr>
<trclass="memitem:ae0d97a4b84268cbe6a7078e1b2717835"><tdclass="memItemLeft"align="right"valign="top">static bool </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classsf_1_1Joystick.html#ae0d97a4b84268cbe6a7078e1b2717835">isButtonPressed</a> (unsigned int joystick, unsigned int button)</td></tr>
<trclass="memdesc:ae0d97a4b84268cbe6a7078e1b2717835"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Check if a joystick button is pressed. <ahref="#ae0d97a4b84268cbe6a7078e1b2717835">More...</a><br/></td></tr>
<trclass="memitem:aea4930193331df1851b709f3060ba58b"><tdclass="memItemLeft"align="right"valign="top">static float </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classsf_1_1Joystick.html#aea4930193331df1851b709f3060ba58b">getAxisPosition</a> (unsigned int joystick, <aclass="el"href="classsf_1_1Joystick.html#a48db337092c2e263774f94de6d50baa7">Axis</a> axis)</td></tr>
<trclass="memdesc:aea4930193331df1851b709f3060ba58b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the current position of a joystick axis. <ahref="#aea4930193331df1851b709f3060ba58b">More...</a><br/></td></tr>
<trclass="memitem:aa917c9435330e6e0368d3893672d1b74"><tdclass="memItemLeft"align="right"valign="top">static <aclass="el"href="structsf_1_1Joystick_1_1Identification.html">Identification</a> </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="classsf_1_1Joystick.html#aa917c9435330e6e0368d3893672d1b74">getIdentification</a> (unsigned int joystick)</td></tr>
<trclass="memdesc:aa917c9435330e6e0368d3893672d1b74"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Get the joystick information. <ahref="#aa917c9435330e6e0368d3893672d1b74">More...</a><br/></td></tr>
<trclass="memdesc:ab85fa9175b4edd3e5a07ee3cde0b0f48"><tdclass="mdescLeft"> </td><tdclass="mdescRight">ServerUpdate the states of all joysticks. <ahref="#ab85fa9175b4edd3e5a07ee3cde0b0f48">More...</a><br/></td></tr>
<divclass="textblock"><p>Give access to the real-time state of the joysticks. </p>
<p><aclass="el"href="classsf_1_1Joystick.html"title="Give access to the real-time state of the joysticks. ">sf::Joystick</a> provides an interface to the state of the joysticks.</p>
<p>It only contains static functions, so it's not meant to be instantiated. Instead, each joystick is identified by an index that is passed to the functions of this class.</p>
<p>This class allows users to query the state of joysticks at any time and directly, without having to deal with a window and its events. Compared to the JoystickMoved, JoystickButtonPressed and JoystickButtonReleased events, <aclass="el"href="classsf_1_1Joystick.html"title="Give access to the real-time state of the joysticks. ">sf::Joystick</a> can retrieve the state of axes and buttons of joysticks 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 joysticks, even if they are moved, pressed or released when your window is out of focus and no event is triggered.</p>
<p>SFML supports: </p><ul>
<li>8 joysticks (<aclass="el"href="classsf_1_1Joystick.html#aee00dd432eacd8369d279b47c3ab4cc5a6e0a2a95bc1da277610c04d80f52715e"title="Maximum number of supported joysticks. ">sf::Joystick::Count</a>) </li>
<li>32 buttons per joystick (<aclass="el"href="classsf_1_1Joystick.html#aee00dd432eacd8369d279b47c3ab4cc5a2f1b8a0a59f2c12a4775c0e1e69e1816"title="Maximum number of supported buttons. ">sf::Joystick::ButtonCount</a>) </li>
<li>8 axes per joystick (<aclass="el"href="classsf_1_1Joystick.html#aee00dd432eacd8369d279b47c3ab4cc5accf3e487c9f6ee2f384351323626a42c"title="Maximum number of supported axes. ">sf::Joystick::AxisCount</a>)</li>
<p>Unlike the keyboard or mouse, the state of joysticks is sometimes not directly available (depending on the OS), therefore an <aclass="el"href="classsf_1_1Joystick.html#ab85fa9175b4edd3e5a07ee3cde0b0f48"title="ServerUpdate the states of all joysticks. ">update()</a> function must be called in order to update the current state of joysticks. When you have a window with event handling, this is done automatically, you don't need to call anything. But if you have no window, or if you want to check joysticks state before creating one, you must call <aclass="el"href="classsf_1_1Joystick.html#ab85fa9175b4edd3e5a07ee3cde0b0f48"title="ServerUpdate the states of all joysticks. ">sf::Joystick::update</a> explicitly.</p>
<p>Usage example: </p><divclass="fragment"><divclass="line"><spanclass="comment">// Is joystick #0 connected?</span></div><divclass="line"><spanclass="keywordtype">bool</span> connected = <aclass="code"href="classsf_1_1Joystick.html#ac7d4e1923e9f9420174f26703ea63d6c">sf::Joystick::isConnected</a>(0);</div><divclass="line"></div><divclass="line"><spanclass="comment">// How many buttons does joystick #0 support?</span></div><divclass="line"><spanclass="keywordtype">unsigned</span><spanclass="keywordtype">int</span> buttons = <aclass="code"href="classsf_1_1Joystick.html#a4de9f445c6582bfe9f0873f695682885">sf::Joystick::getButtonCount</a>(0);</div><divclass="line"></div><divclass="line"><spanclass="comment">// Does joystick #0 define a X axis?</span></div><divclass="line"><spanclass="keywordtype">bool</span> hasX = <aclass="code"href="classsf_1_1Joystick.html#a268e8f2a11ae6af4a47c727cb4ab4d95">sf::Joystick::hasAxis</a>(0, <aclass="code"href="classsf_1_1Joystick.html#a48db337092c2e263774f94de6d50baa7a95dc8b9bf7b0a2157fc67891c54c401e">sf::Joystick::X</a>);</div><divclass="line"></div><divclass="line"><spanclass="comment">// Is button #2 pressed on joystick #0?</span></div><divclass="line"><spanclass="keywordtype">bool</span> pressed = <aclass="code"href="classsf_1_1Joystick.html#ae0d97a4b84268cbe6a7078e1b2717835">sf::Joystick::isButtonPressed</a>(0, 2);</div><divclass="line"></div><divclass="line"><spanclass="comment">// What's the current position of the Y axis on joystick #0?</span></div><divclass="line"><spanclass="keywordtype">float</span> position = <aclass="code"href="classsf_1_1Joystick.html#aea4930193331df1851b709f3060ba58b">sf::Joystick::getAxisPosition</a>(0, <aclass="code"href="classsf_1_1Joystick.html#a48db337092c2e263774f94de6d50baa7a51ef1455f7511ad4a78ba241d66593ce">sf::Joystick::Y</a>);</div></div><!-- fragment --><dlclass="section see"><dt>See also</dt><dd><aclass="el"href="classsf_1_1Keyboard.html"title="Give access to the real-time state of the keyboard. ">sf::Keyboard</a>, <aclass="el"href="classsf_1_1Mouse.html"title="Give access to the real-time state of the mouse. ">sf::Mouse</a></dd></dl>
<pclass="definition">Definition at line <aclass="el"href="Joystick_8hpp_source.html#l00041">41</a> of file <aclass="el"href="Joystick_8hpp_source.html">Joystick.hpp</a>.</p>
<p>Constants related to joysticks capabilities. </p>
<tableclass="fieldtable">
<tr><thcolspan="2">Enumerator</th></tr><tr><tdclass="fieldname"><aid="aee00dd432eacd8369d279b47c3ab4cc5a6e0a2a95bc1da277610c04d80f52715e"></a>Count </td><tdclass="fielddoc"><p>Maximum number of supported joysticks. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="aee00dd432eacd8369d279b47c3ab4cc5a2f1b8a0a59f2c12a4775c0e1e69e1816"></a>ButtonCount </td><tdclass="fielddoc"><p>Maximum number of supported buttons. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="aee00dd432eacd8369d279b47c3ab4cc5accf3e487c9f6ee2f384351323626a42c"></a>AxisCount </td><tdclass="fielddoc"><p>Maximum number of supported axes. </p>
</td></tr>
</table>
<pclass="definition">Definition at line <aclass="el"href="Joystick_8hpp_source.html#l00049">49</a> of file <aclass="el"href="Joystick_8hpp_source.html">Joystick.hpp</a>.</p>
<tr><thcolspan="2">Enumerator</th></tr><tr><tdclass="fieldname"><aid="a48db337092c2e263774f94de6d50baa7a95dc8b9bf7b0a2157fc67891c54c401e"></a>X </td><tdclass="fielddoc"><p>The X axis. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48db337092c2e263774f94de6d50baa7a51ef1455f7511ad4a78ba241d66593ce"></a>Y </td><tdclass="fielddoc"><p>The Y axis. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48db337092c2e263774f94de6d50baa7a7c37a1240b2dafbbfc5c1a0e23911315"></a>Z </td><tdclass="fielddoc"><p>The Z axis. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48db337092c2e263774f94de6d50baa7aeebbcdb0828850f4d69e6a084801fab8"></a>R </td><tdclass="fielddoc"><p>The R axis. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48db337092c2e263774f94de6d50baa7a0a901f61e75292dd2f642b6e4f33a214"></a>U </td><tdclass="fielddoc"><p>The U axis. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48db337092c2e263774f94de6d50baa7aa2e2c8ffa1837e7911ee0c7d045bf8f4"></a>V </td><tdclass="fielddoc"><p>The V axis. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48db337092c2e263774f94de6d50baa7a06420f7714e4dfd8b841885a0b5f3954"></a>PovX </td><tdclass="fielddoc"><p>The X axis of the point-of-view hat. </p>
</td></tr>
<tr><tdclass="fieldname"><aid="a48db337092c2e263774f94de6d50baa7a0f8ffb2dcddf91b98ab910a4f8327ad9"></a>PovY </td><tdclass="fielddoc"><p>The Y axis of the point-of-view hat. </p>
</td></tr>
</table>
<pclass="definition">Definition at line <aclass="el"href="Joystick_8hpp_source.html#l00060">60</a> of file <aclass="el"href="Joystick_8hpp_source.html">Joystick.hpp</a>.</p>
</div>
</div>
<h2class="groupheader">Member Function Documentation</h2>
<p>This function is used internally by SFML, so you normally don't have to call it explicitly. However, you may need to call it if you have no window yet (or no window at all): in this case the joystick states are not updated automatically. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>