24 lines
No EOL
10 KiB
HTML
24 lines
No EOL
10 KiB
HTML
<!doctype html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>Input — Ludic</title>
|
||
<meta name="description" content="Reading input.">
|
||
<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> <span class="here">Input</span></div>
|
||
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Input</h1></div>
|
||
<p class="ns-blurb">Reading input. At the base, <a href="input-key.html"><code>Input.key</code></a> gives this frame's key and <a href="input-poll.html"><code>Input.poll</code></a> is the single per-frame read that also drives deterministic record/replay. Over that sit <strong>named actions</strong> — <a href="input-bind.html"><code>Input.bind</code></a> / <a href="input-down.html"><code>Input.down</code></a> / <a href="input-pressed.html"><code>Input.pressed</code></a> / <a href="input-rebind.html"><code>Input.rebind</code></a> — so gameplay reads rebindable actions, not physical keys.
|
||
|
||
The <strong>device layer</strong> adds everything past one key per frame: multiple simultaneous held keys (<a href="input-key_down.html"><code>Input.key_down</code></a> / <a href="input-key_pressed.html"><code>key_pressed</code></a> / <a href="input-key_released.html"><code>key_released</code></a>), analog <a href="input-axis.html"><code>Input.axis</code></a> and normalized <a href="input-vector.html"><code>Input.vector</code></a>, the <a href="input-mouse_x.html">mouse</a> (position, delta, buttons, <a href="input-wheel.html">wheel</a>), <a href="input-pad_button.html">gamepads</a> and <a href="input-touch_count.html">touch</a>. The held set is fed by the platform when windowed and by the <a href="input-press.html"><code>Input.press</code></a> / <a href="input-set_mouse.html"><code>Input.set_*</code></a> injection on every target — the same idea as Godot's <code>action_press</code>, and what a replay, an AI, or the network feeds. Everything is integer and deterministic, and record/replay snapshots the whole per-frame state.</p>
|
||
<div class="ns-methods"><a class="ns-method" href="input-key.html"><code class="nm-sig">Input.key() -> int</code><span class="nm-tip">The key pressed this frame as a character code (0 when nothing is pressed).</span></a><a class="ns-method" href="input-bind.html"><code class="nm-sig">Input.bind(action: str, key: int) -> void</code><span class="nm-tip">Bind a physical key to a named action, so gameplay reads the action, not the key.</span></a><a class="ns-method" href="input-rebind.html"><code class="nm-sig">Input.rebind(action: str, from: int, to: int) -> void</code><span class="nm-tip">Remap an action from one key to another at runtime (rebinding menus).</span></a><a class="ns-method" href="input-poll.html"><code class="nm-sig">Input.poll() -> int</code><span class="nm-tip">Advance one frame of input; the single per-frame read behind actions and replay.</span></a><a class="ns-method" href="input-down.html"><code class="nm-sig">Input.down(action: str) -> bool</code><span class="nm-tip">Is a named action held on the frame last polled?</span></a><a class="ns-method" href="input-pressed.html"><code class="nm-sig">Input.pressed(action: str) -> bool</code><span class="nm-tip">Did a named action go down this frame (a one-shot edge)?</span></a><a class="ns-method" href="input-record.html"><code class="nm-sig">Input.record() -> void</code><span class="nm-tip">Start recording polled input each frame (for deterministic replay).</span></a><a class="ns-method" href="input-replay.html"><code class="nm-sig">Input.replay() -> void</code><span class="nm-tip">Replay recorded input; poll then reads the tape, not the device.</span></a><a class="ns-method" href="input-key_down.html"><code class="nm-sig">Input.key_down(key) -> bool</code><span class="nm-tip">Is a physical key held this frame?</span></a><a class="ns-method" href="input-key_pressed.html"><code class="nm-sig">Input.key_pressed(key) -> bool</code><span class="nm-tip">Did a key go down this frame (edge)?</span></a><a class="ns-method" href="input-key_released.html"><code class="nm-sig">Input.key_released(key) -> bool</code><span class="nm-tip">Did a key go up this frame (edge)?</span></a><a class="ns-method" href="input-key_label.html"><code class="nm-sig">Input.key_label(key) -> string</code><span class="nm-tip">The name to show a player for a key - in their own keyboard layout.</span></a><a class="ns-method" href="input-press.html"><code class="nm-sig">Input.press(key)</code><span class="nm-tip">Inject a held key (AI, tutorial, testing, network).</span></a><a class="ns-method" href="input-release.html"><code class="nm-sig">Input.release(key)</code><span class="nm-tip">Release an injected key.</span></a><a class="ns-method" href="input-axis.html"><code class="nm-sig">Input.axis(neg, pos) -> fixed</code><span class="nm-tip">A -1..+1 axis from two keys.</span></a><a class="ns-method" href="input-axis_i.html"><code class="nm-sig">Input.axis_i(neg, pos) -> int</code><span class="nm-tip">A -1/0/1 directional intent as a plain int, no bool->int glue.</span></a><a class="ns-method" href="input-vector.html"><code class="nm-sig">Input.vector(left, right, up, down) -> Vector</code><span class="nm-tip">A normalized 2D vector from four keys.</span></a><a class="ns-method" href="input-strength.html"><code class="nm-sig">Input.strength(action) -> fixed</code><span class="nm-tip">0..1 strength of a named action.</span></a><a class="ns-method" href="input-mouse_x.html"><code class="nm-sig">Input.mouse_x() -> int</code><span class="nm-tip">The mouse x position this frame.</span></a><a class="ns-method" href="input-mouse_y.html"><code class="nm-sig">Input.mouse_y() -> int</code><span class="nm-tip">The mouse y position this frame.</span></a><a class="ns-method" href="input-mouse_dx.html"><code class="nm-sig">Input.mouse_dx() -> int</code><span class="nm-tip">Mouse x movement since the last poll.</span></a><a class="ns-method" href="input-mouse_dy.html"><code class="nm-sig">Input.mouse_dy() -> int</code><span class="nm-tip">Mouse y movement since the last poll.</span></a><a class="ns-method" href="input-mouse_down.html"><code class="nm-sig">Input.mouse_down(button) -> bool</code><span class="nm-tip">Is a mouse button held?</span></a><a class="ns-method" href="input-wheel.html"><code class="nm-sig">Input.wheel() -> int</code><span class="nm-tip">Scroll-wheel delta this frame.</span></a><a class="ns-method" href="input-set_mouse.html"><code class="nm-sig">Input.set_mouse(x, y, buttons, wheel)</code><span class="nm-tip">Inject the mouse state (headless / AI / testing).</span></a><a class="ns-method" href="input-pad_connected.html"><code class="nm-sig">Input.pad_connected(pad) -> bool</code><span class="nm-tip">Is a gamepad connected?</span></a><a class="ns-method" href="input-pad_button.html"><code class="nm-sig">Input.pad_button(pad, button) -> bool</code><span class="nm-tip">Is a gamepad button held?</span></a><a class="ns-method" href="input-pad_axis.html"><code class="nm-sig">Input.pad_axis(pad, axis) -> fixed</code><span class="nm-tip">A gamepad analog axis, -1..+1.</span></a><a class="ns-method" href="input-set_pad.html"><code class="nm-sig">Input.set_pad(pad, connected, buttons, lx, ly, rx, ry)</code><span class="nm-tip">Inject a gamepad's whole state.</span></a><a class="ns-method" href="input-touch_count.html"><code class="nm-sig">Input.touch_count() -> int</code><span class="nm-tip">How many touch points are active?</span></a><a class="ns-method" href="input-touch_x.html"><code class="nm-sig">Input.touch_x(index) -> int</code><span class="nm-tip">The x of a touch point.</span></a><a class="ns-method" href="input-touch_y.html"><code class="nm-sig">Input.touch_y(index) -> int</code><span class="nm-tip">The y of a touch point.</span></a><a class="ns-method" href="input-set_touch.html"><code class="nm-sig">Input.set_touch(index, x, y, active)</code><span class="nm-tip">Inject a touch point.</span></a><a class="ns-method" href="input-action.html"><code class="nm-sig">Input.action(action: str, key: int) -> void</code><span class="nm-tip">Register a default key binding for an action (kept if already bound).</span></a><a class="ns-method" href="input-bind_pad.html"><code class="nm-sig">Input.bind_pad(action: str, button: int) -> void</code><span class="nm-tip">Also fire a named action from a gamepad button (device-agnostic).</span></a><a class="ns-method" href="input-active.html"><code class="nm-sig">Input.active(action: str) -> bool</code><span class="nm-tip">Is a named action active right now (any bound key held, or pad button down)?</span></a><a class="ns-method" href="input-just_pressed.html"><code class="nm-sig">Input.just_pressed(action: str) -> bool</code><span class="nm-tip">Did a named action go active this frame (the deterministic on-press)?</span></a><a class="ns-method" href="input-just_released.html"><code class="nm-sig">Input.just_released(action: str) -> bool</code><span class="nm-tip">Did a named action go inactive this frame (the on-release edge)?</span></a><a class="ns-method" href="input-cursor_mode.html"><code class="nm-sig">Input.cursor_mode(mode)</code><span class="nm-tip">Hide / lock / confine the OS mouse cursor to the window (windowed).</span></a><a class="ns-method" href="input-move_i.html"><code class="nm-sig">Input.move_i() -> IVec2</code><span class="nm-tip">The standard top-down movement intent, -1/0/1 per axis.</span></a></div>
|
||
<a class="back" href="api.html">← All symbols</a>
|
||
</main>
|
||
<script src="ludic-highlight.js"></script>
|
||
<script>Ludic.installCards(); Ludic.flashTarget();</script>
|
||
</body></html> |