ludic/ns-rect.html
2026-09-17 22:10:03 +00:00

22 lines
No EOL
3.2 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Rect — Ludic</title>
<meta name="description" content="Axis-aligned rectangles for HUD layout boxes, hitboxes, and camera regions.">
<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">Rect</span></div>
<div class="item-head"><span class="kind-badge kind-namespace">namespace</span><h1 id="top">Rect</h1></div>
<p class="ns-blurb">Axis-aligned rectangles for HUD layout boxes, hitboxes, and camera regions. A <code>Rect</code> is four Q16.16 <code>fixed</code> components — position <code>(x, y)</code> (its top-left corner) and size <code>(w, h)</code> — packed into a single value that is copied by value and never allocates. It offers fast point-in-rect and rectangle-overlap tests. Every operation is deterministic fixed-point, bit-identical on every platform. Arguments are positional.</p>
<div class="ns-methods"><a class="ns-method" href="rect-make.html"><code class="nm-sig">Rect.make(x, y, w, h) -&gt; Rect</code><span class="nm-tip">Build a rectangle from a corner and a size.</span></a><a class="ns-method" href="rect-x.html"><code class="nm-sig">Rect.x(r) -&gt; fixed</code><span class="nm-tip">The left edge (x position).</span></a><a class="ns-method" href="rect-y.html"><code class="nm-sig">Rect.y(r) -&gt; fixed</code><span class="nm-tip">The top edge (y position).</span></a><a class="ns-method" href="rect-w.html"><code class="nm-sig">Rect.w(r) -&gt; fixed</code><span class="nm-tip">The width.</span></a><a class="ns-method" href="rect-h.html"><code class="nm-sig">Rect.h(r) -&gt; fixed</code><span class="nm-tip">The height.</span></a><a class="ns-method" href="rect-right.html"><code class="nm-sig">Rect.right(r) -&gt; fixed</code><span class="nm-tip">The right edge, x + w.</span></a><a class="ns-method" href="rect-bottom.html"><code class="nm-sig">Rect.bottom(r) -&gt; fixed</code><span class="nm-tip">The bottom edge, y + h.</span></a><a class="ns-method" href="rect-center.html"><code class="nm-sig">Rect.center(r) -&gt; Vector</code><span class="nm-tip">The center point as a Vector.</span></a><a class="ns-method" href="rect-contains.html"><code class="nm-sig">Rect.contains(r, px, py) -&gt; bool</code><span class="nm-tip">True when the point is inside.</span></a><a class="ns-method" href="rect-intersects.html"><code class="nm-sig">Rect.intersects(a, b) -&gt; bool</code><span class="nm-tip">True when two rectangles overlap.</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>