34 lines
No EOL
2.1 KiB
HTML
34 lines
No EOL
2.1 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Input.axis_i — Ludic</title>
|
||
<meta name="description" content="A -1/0/1 directional intent as a plain int, no bool->int glue.">
|
||
<link rel="stylesheet" href="base.css">
|
||
<link rel="stylesheet" href="docs.css">
|
||
</head>
|
||
<body>
|
||
<header class="nav"><div class="wrap nav-in"><a class="brand" href="index.html"><span class="logo">L</span> Ludic</a><button class="nav-toggle" aria-label="Toggle menu" aria-expanded="false">☰</button><nav class="nav-links"><a href="index.html">Home</a><a href="api.html">API Reference</a><a class="nav-cta" href="https://git.workshopsoft.io/workshopsoft/ludic">Source ↗</a></nav></div></header>
|
||
<main class="wrap item">
|
||
<div class="crumbs"><a href="api.html">API Reference</a> <span>›</span> <a href="ns-input.html">Input</a> <span>›</span> <span class="here">Input.axis_i</span></div>
|
||
<div class="item-head">
|
||
<span class="kind-badge kind-method">method</span>
|
||
<h1 id="top">Input.axis_i</h1>
|
||
</div>
|
||
<code class="sig">Input.axis_i(neg, pos) -> int</code>
|
||
<div class="desc"><p>Returns a directional intent as a plain <code>int</code>: <code>+1</code> when the positive key is held, <code>-1</code> when the negative one is, <code>0</code> for neither or both. It reads the multi-key device set, so it replaces the <code>ki(key_down('d')) - ki(key_down('a'))</code> boolean-to-int boilerplate and feeds an int mover directly — <code>dx = Input.axis_i('a', 'd')</code>, <code>dy = Input.axis_i('w', 's')</code>. For an analog / normalized value use <a href="input-axis.html"><code>Input.axis</code></a> (fixed) or <a href="input-vector.html"><code>Input.vector</code></a>.</p></div>
|
||
|
||
<div class="examples"><h2>Example</h2><pre data-lang="ludic">program Demo {
|
||
entry {
|
||
Input.press('d')
|
||
Input.poll()
|
||
print(Input.axis_i('a', 'd')) # 1
|
||
}
|
||
}</pre></div>
|
||
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.highlightAll(); Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |