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

286 lines
18 KiB
HTML
Raw Normal View History

2024-05-30 15:04:39 +00:00
<!-- HTML header for doxygen 1.9.7-->
2024-05-29 17:40:11 +00:00
<!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>
2024-05-29 22:09:05 +00:00
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
2024-05-29 17:40:11 +00:00
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
2024-05-30 15:18:28 +00:00
<link rel="search" href="search_opensearch.php?v=opensearch.xml" type="application/opensearchdescription+xml" title="godot-cpp-utils"/>
2024-05-29 17:40:11 +00:00
<link href="doxygen.css" rel="stylesheet" type="text/css" />
2024-05-29 22:10:08 +00:00
<link href="doxygen-awesome.css" rel="stylesheet" type="text/css"/>
2024-05-30 15:13:10 +00:00
<link href="doxygen-awesome-sidebar-only.css" rel="stylesheet" type="text/css"/>
<link href="doxygen-awesome-sidebar-only-darkmode-toggle.css" rel="stylesheet" type="text/css"/>
2024-05-30 15:04:39 +00:00
<script type="text/javascript" src="doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</script>
2024-05-29 17:40:11 +00:00
</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>
2024-05-30 15:18:28 +00:00
<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,true,'search.php','Search');
$(document).ready(function() {
if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }
});
});
/* @license-end */
</script>
<div id="main-nav"></div>
2024-05-29 22:09:05 +00:00
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(document).ready(function(){initNavTree('classutils_1_1PlayerInput.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
2024-05-29 17:40:11 +00:00
<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-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>
2024-05-30 15:18:28 +00:00
<div id="dynsection-0" onclick="return toggleVisibility(this)" class="dynheader closed" style="cursor:pointer;">
<img id="dynsection-0-trigger" src="closed.png" alt="+"/> Inheritance diagram for utils::PlayerInput:</div>
<div id="dynsection-0-summary" class="dynsummary" style="display:block;">
</div>
<div id="dynsection-0-content" class="dyncontent" style="display:none;">
2024-05-29 17:40:11 +00:00
<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: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-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 -->
2024-05-29 22:09:05 +00:00
</div><!-- doc-content -->
2024-05-29 17:40:11 +00:00
<!-- start footer part -->
2024-05-29 22:09:05 +00:00
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><b>utils</b></li><li class="navelem"><a class="el" href="classutils_1_1PlayerInput.html">PlayerInput</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7 </li>
</ul>
</div>
2024-05-29 17:40:11 +00:00
</body>
</html>