New Hugo site in website/ with prosperon.dev theme (blue/gold/castle aesthetic), docs sidebar navigation, and content pages. Rewrote all doc files to align with the actual codebase: compositor+film2d rendering, use() modules (no global prosperon object), Pit language, script+JSON entity model. Added entities.md, front matter to all 70+ API docs, and updated API index for current module architecture. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
63 lines
2.4 KiB
Markdown
63 lines
2.4 KiB
Markdown
---
|
|
title: "API Reference"
|
|
type: docs
|
|
---
|
|
|
|
# API Reference
|
|
|
|
Prosperon's API is a set of modules imported with `use()`. There is no global engine object — import only what you need.
|
|
|
|
## Game-Facing Modules
|
|
|
|
These are the modules you use to build games:
|
|
|
|
| Module | Import | Purpose |
|
|
|--------|--------|---------|
|
|
| **core** | `use('core')` | Main loop, window, GPU initialization |
|
|
| **sprite** | `use('sprite')` | Create and manage sprites |
|
|
| **compositor** | `use('compositor')` | Build render plans from scene configs |
|
|
| **camera** | `use('camera')` | Viewport into the world |
|
|
| **input** | `use('input')` | Action mapping, device routing, control stacks |
|
|
| **sound** | `use('sound')` | Audio playback and mixing |
|
|
| **world** | `use('world')` | Entity management |
|
|
| **text2d** | `use('text2d')` | Text rendering |
|
|
| **shape2d** | `use('shape2d')` | SDF-rendered shapes (rect, circle, ellipse, pill) |
|
|
| **tilemap2d** | `use('tilemap2d')` | Grid-based tile rendering |
|
|
| **line2d** | `use('line2d')` | Line rendering |
|
|
| **particles2d** | `use('particles2d')` | Particle emitters |
|
|
| **tween** | `use('tween')` | Value interpolation over time |
|
|
| **ease** | `use('ease')` | Easing functions |
|
|
| **color** | `use('color')` | Color utilities |
|
|
| **resources** | `use('resources')` | Asset path resolution |
|
|
| **action** | `use('action')` | Action definitions |
|
|
| **draw2d** | `use('draw2d')` | Immediate-mode 2D drawing |
|
|
| **clay** | `use('clay')` | UI layout |
|
|
| **point** | `use('point')` | Point/vector utilities |
|
|
|
|
## Actor Primitives
|
|
|
|
These are built into the Pit language runtime and available in all `.ce` programs:
|
|
|
|
| Primitive | Purpose |
|
|
|-----------|---------|
|
|
| `$start(callback, path)` | Spawn a child actor from a program |
|
|
| `$receiver(callback)` | Register a message handler |
|
|
| `send(target, message)` | Send a message to an actor |
|
|
| `$delay(callback, seconds)` | Schedule a one-shot callback |
|
|
| `$clock(callback, interval)` | Schedule a repeating callback |
|
|
| `$stop()` | Terminate the current actor |
|
|
|
|
## Globals
|
|
|
|
| Name | Purpose |
|
|
|------|---------|
|
|
| `use(path)` | Import a module |
|
|
| `log.console(msg)` | Print to console |
|
|
| `meme(proto, data)` | Create object with prototype and overrides |
|
|
|
|
## Internal Modules
|
|
|
|
These are used by the engine internally and not intended for direct game use:
|
|
|
|
`film2d`, `effects`, `sdl_gpu`, `graphics`, `rasterize`, `fx_graph`, `debug_imgui`, `device`, `input/backends/*`, `input/bindings`, `input/devices`, `input/router`
|