godot-cpp-utils-docs/html/classutils_1_1PlayerInput.html

295 lines
19 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>godot-cpp-utils: utils::PlayerInput Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript" src="darkmode_toggle.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">godot-cpp-utils
</div>
<div id="projectbrief">A collection of utility classes, functions and macros for use with Godot and GDExtension.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.7 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search/",'.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><b>utils</b></li><li class="navelem"><a class="el" href="classutils_1_1PlayerInput.html">PlayerInput</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pri-static-methods">Static Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="#pri-static-attribs">Static Private Attributes</a> &#124;
<a href="classutils_1_1PlayerInput-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">utils::PlayerInput Class Reference</div></div>
</div><!--header-->
<div class="contents">
<p>An event-driven input observer.
<a href="classutils_1_1PlayerInput.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="player__input_8hpp_source.html">player_input.hpp</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for utils::PlayerInput:</div>
<div class="dyncontent">
<div class="center">
<img src="classutils_1_1PlayerInput.png" alt=""/>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structutils_1_1PlayerInput_1_1Listener.html">Listener</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">A <a class="el" href="classutils_1_1PlayerInput.html" title="An event-driven input observer.">PlayerInput</a> action listener. <a href="structutils_1_1PlayerInput_1_1Listener.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae2189d9c51827d6609874c97ee48bdbf"><td class="memItemLeft" align="right" valign="top"><a id="ae2189d9c51827d6609874c97ee48bdbf" name="ae2189d9c51827d6609874c97ee48bdbf"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>_enter_tree</b> () override</td></tr>
<tr class="separator:ae2189d9c51827d6609874c97ee48bdbf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0302b419cd7a8d8544467592279df16d"><td class="memItemLeft" align="right" valign="top"><a id="a0302b419cd7a8d8544467592279df16d" name="a0302b419cd7a8d8544467592279df16d"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>_exit_tree</b> () override</td></tr>
<tr class="separator:a0302b419cd7a8d8544467592279df16d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ed7a3a7b7c846e8629db3ec3482821b"><td class="memItemLeft" align="right" valign="top"><a id="a2ed7a3a7b7c846e8629db3ec3482821b" name="a2ed7a3a7b7c846e8629db3ec3482821b"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>_unhandled_input</b> (gd::Ref&lt; gd::InputEvent &gt; const &amp;event) override</td></tr>
<tr class="separator:a2ed7a3a7b7c846e8629db3ec3482821b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4d96ecb1e5f910ec1f8b94f3ead7bb9f"><td class="memItemLeft" align="right" valign="top"><a id="a4d96ecb1e5f910ec1f8b94f3ead7bb9f" name="a4d96ecb1e5f910ec1f8b94f3ead7bb9f"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>_process</b> (double deltaTime) override</td></tr>
<tr class="separator:a4d96ecb1e5f910ec1f8b94f3ead7bb9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a52f0f96cd4732ce06016459094d3a714"><td class="memItemLeft" align="right" valign="top"><a id="a52f0f96cd4732ce06016459094d3a714" name="a52f0f96cd4732ce06016459094d3a714"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>listen_to</b> (<a class="el" href="structutils_1_1PlayerInput_1_1Listener.html">Listener</a> const &amp;listener)</td></tr>
<tr class="memdesc:a52f0f96cd4732ce06016459094d3a714"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start listening for action. <br /></td></tr>
<tr class="separator:a52f0f96cd4732ce06016459094d3a714"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a437e47975e21f8b61fabd69cebd8f8ba"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classutils_1_1PlayerInput.html#a437e47975e21f8b61fabd69cebd8f8ba">listen_to</a> (gd::String action, gd::Callable callable)</td></tr>
<tr class="memdesc:a437e47975e21f8b61fabd69cebd8f8ba"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start listening for action. <br /></td></tr>
<tr class="separator:a437e47975e21f8b61fabd69cebd8f8ba"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8408ea63291e4c9a93c199a55ccb3f21"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classutils_1_1PlayerInput.html#a8408ea63291e4c9a93c199a55ccb3f21">listen_to</a> (gd::String negative, gd::String positive, gd::Callable callable)</td></tr>
<tr class="memdesc:a8408ea63291e4c9a93c199a55ccb3f21"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start listening for action. <br /></td></tr>
<tr class="separator:a8408ea63291e4c9a93c199a55ccb3f21"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aedfe45a2286098d3e5c9bfc00fddd1e1"><td class="memItemLeft" align="right" valign="top"><a id="aedfe45a2286098d3e5c9bfc00fddd1e1" name="aedfe45a2286098d3e5c9bfc00fddd1e1"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>stop_listening</b> (Node *node)</td></tr>
<tr class="memdesc:aedfe45a2286098d3e5c9bfc00fddd1e1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove any listeners related to node. <br /></td></tr>
<tr class="separator:aedfe45a2286098d3e5c9bfc00fddd1e1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5620664764fc42b545a4304700180275"><td class="memItemLeft" align="right" valign="top"><a id="a5620664764fc42b545a4304700180275" name="a5620664764fc42b545a4304700180275"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>stop_listening</b> (<a class="el" href="structutils_1_1PlayerInput_1_1Listener.html">Listener</a> const &amp;listener)</td></tr>
<tr class="memdesc:a5620664764fc42b545a4304700180275"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove listeners exactly equal to listener. <br /></td></tr>
<tr class="separator:a5620664764fc42b545a4304700180275"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1b3a6b23e41e3a4b57d916e6ed0fab6b"><td class="memItemLeft" align="right" valign="top"><a id="a1b3a6b23e41e3a4b57d916e6ed0fab6b" name="a1b3a6b23e41e3a4b57d916e6ed0fab6b"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>clear_listeners</b> ()</td></tr>
<tr class="memdesc:a1b3a6b23e41e3a4b57d916e6ed0fab6b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Remove all listeners. <br /></td></tr>
<tr class="separator:a1b3a6b23e41e3a4b57d916e6ed0fab6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a63928906c8769151ef37adcad505de35"><td class="memItemLeft" align="right" valign="top"><a id="a63928906c8769151ef37adcad505de35" name="a63928906c8769151ef37adcad505de35"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>set_device</b> (int id)</td></tr>
<tr class="memdesc:a63928906c8769151ef37adcad505de35"><td class="mdescLeft">&#160;</td><td class="mdescRight">set the device observe events from. <br /></td></tr>
<tr class="separator:a63928906c8769151ef37adcad505de35"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-static-methods" name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a689cc968b84d6a92c10c541b97e3477e"><td class="memItemLeft" align="right" valign="top"><a id="a689cc968b84d6a92c10c541b97e3477e" name="a689cc968b84d6a92c10c541b97e3477e"></a>
static gd::Vector2&#160;</td><td class="memItemRight" valign="bottom"><b>get_last_mouse_motion</b> ()</td></tr>
<tr class="memdesc:a689cc968b84d6a92c10c541b97e3477e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the last stored mouse delta. <br /></td></tr>
<tr class="separator:a689cc968b84d6a92c10c541b97e3477e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-static-methods" name="pri-static-methods"></a>
Static Private Member Functions</h2></td></tr>
<tr class="memitem:a477edf5df5d239411d87025a7dde58e6"><td class="memItemLeft" align="right" valign="top"><a id="a477edf5df5d239411d87025a7dde58e6" name="a477edf5df5d239411d87025a7dde58e6"></a>
static void&#160;</td><td class="memItemRight" valign="bottom"><b>_bind_methods</b> ()</td></tr>
<tr class="separator:a477edf5df5d239411d87025a7dde58e6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-attribs" name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr class="memitem:a10749b40d6eafb1f6c11dc056f70e380"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classutils_1_1PlayerInput.html#a10749b40d6eafb1f6c11dc056f70e380">isPrimary</a> {false}</td></tr>
<tr class="memdesc:a10749b40d6eafb1f6c11dc056f70e380"><td class="mdescLeft">&#160;</td><td class="mdescRight">Is this the primary instance. <br /></td></tr>
<tr class="separator:a10749b40d6eafb1f6c11dc056f70e380"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af9aa77b42fac8fb673089d37105b932c"><td class="memItemLeft" align="right" valign="top"><a id="af9aa77b42fac8fb673089d37105b932c" name="af9aa77b42fac8fb673089d37105b932c"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>device</b> {-1}</td></tr>
<tr class="memdesc:af9aa77b42fac8fb673089d37105b932c"><td class="mdescLeft">&#160;</td><td class="mdescRight">which device to observe events from. <br /></td></tr>
<tr class="separator:af9aa77b42fac8fb673089d37105b932c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7dff7a6e68eeb89b2ff57b8e5447050d"><td class="memItemLeft" align="right" valign="top"><a id="a7dff7a6e68eeb89b2ff57b8e5447050d" name="a7dff7a6e68eeb89b2ff57b8e5447050d"></a>
gd::Vector&lt; <a class="el" href="structutils_1_1PlayerInput_1_1Listener.html">Listener</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>listeners</b> {}</td></tr>
<tr class="memdesc:a7dff7a6e68eeb89b2ff57b8e5447050d"><td class="mdescLeft">&#160;</td><td class="mdescRight">current listeners for this instance <br /></td></tr>
<tr class="separator:a7dff7a6e68eeb89b2ff57b8e5447050d"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-static-attribs" name="pri-static-attribs"></a>
Static Private Attributes</h2></td></tr>
<tr class="memitem:a99e2dbf29ad4b1d97e7c295407cff335"><td class="memItemLeft" align="right" valign="top"><a id="a99e2dbf29ad4b1d97e7c295407cff335" name="a99e2dbf29ad4b1d97e7c295407cff335"></a>
static gd::Vector2&#160;</td><td class="memItemRight" valign="bottom"><b>lastMouseMotion</b> {0.f, 0.f}</td></tr>
<tr class="memdesc:a99e2dbf29ad4b1d97e7c295407cff335"><td class="mdescLeft">&#160;</td><td class="mdescRight">The last mouse motion, updated by the primary instance. <br /></td></tr>
<tr class="separator:a99e2dbf29ad4b1d97e7c295407cff335"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aacf94bfd501145c640767a7018cfdb76"><td class="memItemLeft" align="right" valign="top"><a id="aacf94bfd501145c640767a7018cfdb76" name="aacf94bfd501145c640767a7018cfdb76"></a>
static bool&#160;</td><td class="memItemRight" valign="bottom"><b>primaryExists</b> {false}</td></tr>
<tr class="memdesc:aacf94bfd501145c640767a7018cfdb76"><td class="mdescLeft">&#160;</td><td class="mdescRight">Does a primary instance exist. <br /></td></tr>
<tr class="separator:aacf94bfd501145c640767a7018cfdb76"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>An event-driven input observer. </p>
<p>Listen for events with <code>listen_to</code>, registering godot input action names to callbacks. It's possible to register an "axis" by registering a listener with a positive and negative action. </p>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a437e47975e21f8b61fabd69cebd8f8ba" name="a437e47975e21f8b61fabd69cebd8f8ba"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a437e47975e21f8b61fabd69cebd8f8ba">&#9670;&#160;</a></span>listen_to() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void utils::PlayerInput::listen_to </td>
<td>(</td>
<td class="paramtype">gd::String&#160;</td>
<td class="paramname"><em>action</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">gd::Callable&#160;</td>
<td class="paramname"><em>callable</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Start listening for action. </p>
<p>Shorthand for <code>listen_to(Listener(action, callable))</code>. </p>
</div>
</div>
<a id="a8408ea63291e4c9a93c199a55ccb3f21" name="a8408ea63291e4c9a93c199a55ccb3f21"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8408ea63291e4c9a93c199a55ccb3f21">&#9670;&#160;</a></span>listen_to() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void utils::PlayerInput::listen_to </td>
<td>(</td>
<td class="paramtype">gd::String&#160;</td>
<td class="paramname"><em>negative</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">gd::String&#160;</td>
<td class="paramname"><em>positive</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">gd::Callable&#160;</td>
<td class="paramname"><em>callable</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Start listening for action. </p>
<p>Shorthand for <code>listen_to(Listener(negative, positive, callable))</code>. </p>
</div>
</div>
<h2 class="groupheader">Member Data Documentation</h2>
<a id="a10749b40d6eafb1f6c11dc056f70e380" name="a10749b40d6eafb1f6c11dc056f70e380"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a10749b40d6eafb1f6c11dc056f70e380">&#9670;&#160;</a></span>isPrimary</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool utils::PlayerInput::isPrimary {false}</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Is this the primary instance. </p>
<p>The primary instance is responsible for updating static variables like lastMouseMotion. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="player__input_8hpp_source.html">player_input.hpp</a></li>
<li>player_input.cpp</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7
</small></address>
</body>
</html>