Phase 1 of the fuller type-system proposal: two by-value spatial types that lower to packed integers (no heap, copy like scalars). - IVec2 — integer 2D vector, a pair of int packed into one i64, for tile and grid coordinates: make/zero/x/y/add/sub/scale/dot, the grid distance manhattan, equal, and to_vector (widen into the fixed-point Vector). - Rect — axis-aligned rectangle, four Q16.16 fixed components packed into one i128, for HUD boxes and hitboxes: make/x/y/w/h, the derived right/bottom/center, and the contains (point) / intersects (overlap) tests. Both are exact and deterministic, bit-identical on every platform. Vector and Color already cover phase 1's other 2D primitives. Wired end to end: emit_core llty (IVec2->i64, Rect->i128), emit_call dispatch, the FRAGS list + reseeded seed, a selfhost test (types2d), per-symbol docs + type pages + inventory, and the vocabulary/editor sync (header, JetBrains, TextMate, LSP). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
528 B
Markdown
22 lines
528 B
Markdown
---
|
|
id: ivec2-make
|
|
name: IVec2.make
|
|
category: ivec2
|
|
kind: namespace-method
|
|
tokens: IVec2.make
|
|
sig: IVec2.make(x, y) -> IVec2
|
|
tip: Build an integer vector from x and y components.
|
|
order: 0
|
|
ns: IVec2
|
|
member: make
|
|
---
|
|
|
|
Builds an <code>IVec2</code> from its integer <code>x</code> and <code>y</code> components. This is the usual way to name a tile or grid cell; read the parts back with <code>IVec2.x</code> and <code>IVec2.y</code>.
|
|
|
|
```ludic
|
|
program Demo {
|
|
handler Step phase Update {
|
|
let cell = IVec2.make(4, 7)
|
|
}
|
|
}
|
|
```
|