townengine/docs/wiki/input-system.html

30 lines
1.3 KiB
HTML
Raw Normal View History

2025-02-04 04:32:25 +00:00
<!doctype html>
<html>
<head>
<title>Townengine Wiki : Input System</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1 style="margin-bottom:0in;">T2. Input System</h1>
<a href="index.html">Go back
<p><a name="design"></a><strong>T2.1 </strong><strong>Design</strong>
<blockquote>
<p>One of goals is to make system that has the least variance in handling. We combine mouse inputs with keys
and don't use keycodes whatsoever. Key combinations are supported. Everything is represented with an encoded string:
<pre>[control+]+control</pre>
Any variant should be combinable, even things like mouse movement + key press.
<p>One current limitation of such design is that actions will only be reported in next frame after they
were first declared, creating delay. It's possible to fix it in the future however.
</blockquote>
<p><a name="api"></a><strong>T2.2 </strong><strong>API</strong>
<blockquote>
<p>It's rather small:<pre>
void input_action(const char *name, const char *control);
bool input_action_pressed(const char *name);
bool input_action_just_pressed(const char *name);
bool input_action_just_released(const char *name);
Vec2 input_action_position(const char *name);</pre>
</blockquote>
</body>
</html>