# AGENTS
Roast2d Game Engine
## Rule
- Use TDD to fix bugs
- xy coordinate system, x increases from left to right, y increases from bottom to top, center point is (0.0, 0.0)
## Project Structure
- `src/lib.rs` is the root crate, which re-exports the engine implementation from `crates/roast2d_internal`.
- `crates/roast2d_internal` is the engine crate, which contains the core engine implementation.
- `crates/roast2d_macro` is the proc-macro crate, which contains the proc-macros used by the engine.
- `crates/roast2d_dylib` is the dynamic linking crate, which contains the dynamic linking implementation.
- `examples/` contains the runtime examples.
- `assets/` contains the shared assets.
- `benches/` contains the benchmarks.
- `tools/` contains the maintenance scripts.
- `skills/` LLM agent skills.
### Rendering
- Core rendering lives under `crates/roast2d_internal/src/renderer/` and is grouped by domain:
- `render2d/` — 2D pipelines (`default.rs`, `line.rs`, `circle.rs`), batching (`render.rs`), and the 2D runner (`runner.rs`).
- `render3d/` — 3D mesh draw types (`draw3d.rs`) and the 3D runner (`runner.rs`).
- `post/` — post-process pipelines (`screen.rs`, `retro.rs`).
- `driver.rs` — `RenderDriver`, which orchestrates a frame: clears the offscreen once, records 3D, then 2D world/UI, then runs post.
- `traits.rs`, `resource.rs` — shared shaders traits and texture cache/upload helpers.
- The high-level engine state for presentation is in `crates/roast2d_internal/src/render.rs`.
## Commands
- `cargo fmt --all` formats
- `cargo check --all` fast check
- `tools/check.sh` full check
## Ui
- Egui integration is behind the `egui` feature