refactor(stdlib): de-abbreviate namespaces (Mem/Sys/Net/Collide)
Expand the abbreviated public namespaces to full words, part of the language-wide de-abbreviation pass: Mem -> Memory, Sys -> System, Net -> Network, Collide -> Collision Math stays (universally accepted, like int/bool). Renames the dispatch strings, LSP signatures, docs (dirs, files, frontmatter), and the inventory manifest; behavior is byte-identical (the bare rt_ targets are unchanged). Reseeded; C-free bootstrap fixpoint holds; all suites green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
6e6467b515
commit
2f19c8d8e2
50 changed files with 360 additions and 360 deletions
7
docs/language/collision/_section.md
Normal file
7
docs/language/collision/_section.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
id: collision
|
||||
title: Collision
|
||||
order: 6
|
||||
---
|
||||
|
||||
2D overlap tests on integer coordinates (pixels or tiles). Rectangles are <code>(x, y, w, h)</code> from the top-left; circles are <code>(x, y, r)</code>. Each returns a bool. Squared distances are computed in 64-bit so large coordinates never overflow.
|
||||
22
docs/language/collision/collision-circles.md
Normal file
22
docs/language/collision/collision-circles.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
id: collision-circles
|
||||
name: Collision.circles
|
||||
category: collision
|
||||
kind: namespace-method
|
||||
tokens: Collision.circles
|
||||
sig: Collision.circles(ax, ay, ar, bx, by, br) -> bool
|
||||
tip: Do two circles overlap?
|
||||
order: 2
|
||||
ns: Collision
|
||||
member: circles
|
||||
---
|
||||
|
||||
Returns <code>true</code> when circles centred at <code>(ax, ay)</code> and <code>(bx, by)</code> with radii <code>ar</code> and <code>br</code> overlap — that is, when the distance between centres is at most <code>ar + br</code>. It compares squared distances internally, so there is no square root and no precision loss.
|
||||
|
||||
```ludic
|
||||
program Demo {
|
||||
handler Step phase Update {
|
||||
if Collision.circles(px, py, 8, ex, ey, 8) { collide() }
|
||||
}
|
||||
}
|
||||
```
|
||||
22
docs/language/collision/collision-point_rect.md
Normal file
22
docs/language/collision/collision-point_rect.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
id: collision-point_rect
|
||||
name: Collision.point_rect
|
||||
category: collision
|
||||
kind: namespace-method
|
||||
tokens: Collision.point_rect
|
||||
sig: Collision.point_rect(px, py, rx, ry, rw, rh) -> bool
|
||||
tip: Is a point inside a rectangle?
|
||||
order: 1
|
||||
ns: Collision
|
||||
member: point_rect
|
||||
---
|
||||
|
||||
Returns <code>true</code> when the point <code>(px, py)</code> lies within the rectangle <code>(rx, ry, rw, rh)</code> — inclusive on the top-left edge, exclusive on the bottom-right. Use it for mouse or touch hit-testing against a button or a world region.
|
||||
|
||||
```ludic
|
||||
program Demo {
|
||||
handler Step phase Update {
|
||||
if Collision.point_rect(mx, my, bx, by, bw, bh) { press() }
|
||||
}
|
||||
}
|
||||
```
|
||||
22
docs/language/collision/collision-rect_circle.md
Normal file
22
docs/language/collision/collision-rect_circle.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
id: collision-rect_circle
|
||||
name: Collision.rect_circle
|
||||
category: collision
|
||||
kind: namespace-method
|
||||
tokens: Collision.rect_circle
|
||||
sig: Collision.rect_circle(rx, ry, rw, rh, cx, cy, cr) -> bool
|
||||
tip: Does a rectangle overlap a circle?
|
||||
order: 3
|
||||
ns: Collision
|
||||
member: rect_circle
|
||||
---
|
||||
|
||||
Returns <code>true</code> when the rectangle <code>(rx, ry, rw, rh)</code> overlaps the circle centred at <code>(cx, cy)</code> with radius <code>cr</code>. It finds the point on the rectangle nearest the circle's centre and checks whether it falls within the radius — the correct test for a round actor against a blocky tile.
|
||||
|
||||
```ludic
|
||||
program Demo {
|
||||
handler Step phase Update {
|
||||
if Collision.rect_circle(tx, ty, 16, 16, bx, by, 6) { block() }
|
||||
}
|
||||
}
|
||||
```
|
||||
22
docs/language/collision/collision-rects.md
Normal file
22
docs/language/collision/collision-rects.md
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
id: collision-rects
|
||||
name: Collision.rects
|
||||
category: collision
|
||||
kind: namespace-method
|
||||
tokens: Collision.rects
|
||||
sig: Collision.rects(ax, ay, aw, ah, bx, by, bw, bh) -> bool
|
||||
tip: Do two rectangles overlap?
|
||||
order: 0
|
||||
ns: Collision
|
||||
member: rects
|
||||
---
|
||||
|
||||
Returns <code>true</code> when the axis-aligned rectangles <code>(ax, ay, aw, ah)</code> and <code>(bx, by, bw, bh)</code> overlap. Edges that merely touch do not count as overlapping. This is the standard broad-phase test for two hitboxes, tiles, or UI regions.
|
||||
|
||||
```ludic
|
||||
program Demo {
|
||||
handler Step phase Update {
|
||||
if Collision.rects(px, py, 16, 16, ex, ey, 16, 16) { hit() }
|
||||
}
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue