66 lines
3.3 KiB
Markdown
66 lines
3.3 KiB
Markdown
# CLAUDE.md
|
|
|
|
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
|
|
## Project
|
|
|
|
Dusk is a C11 RPG game targeting resource-constrained hardware (PSP, GameCube, Wii, PS Vita, Knulli handhelds) and Linux/OpenGL. All game code lives in `src/dusk/`; platform-specific backends live in `src/dusk{platform}/` (e.g. `src/duskgl/`, `src/duskpsp/`, `src/duskdolphin/`).
|
|
|
|
Assets are zipped into `dusk.dsk` at build time and loaded at runtime via the asset system.
|
|
|
|
## Build
|
|
|
|
```bash
|
|
# Linux (host)
|
|
./scripts/build-linux.sh # outputs build-linux/Dusk
|
|
|
|
# Other targets (require Docker)
|
|
./scripts/build-psp-docker.sh
|
|
./scripts/build-gamecube-docker.sh
|
|
./scripts/build-wii-docker.sh
|
|
./scripts/build-knulli-docker.sh
|
|
```
|
|
|
|
Each script is a thin wrapper around:
|
|
```bash
|
|
cmake -S . -B build-<target> -DDUSK_TARGET_SYSTEM=<target>
|
|
cmake --build build-<target> -- -j$(nproc)
|
|
```
|
|
|
|
## Tests
|
|
|
|
```bash
|
|
./scripts/test-linux.sh # builds and runs all tests
|
|
|
|
# Manually run a single test binary after building:
|
|
./build-tests/test/<module>/test_<name>
|
|
```
|
|
|
|
Tests use [cmocka](https://cmocka.org/) and are only compiled when `DUSK_BUILD_TESTS=ON`. Test sources live under `test/`.
|
|
|
|
## Key conventions
|
|
|
|
- Use `stringCompare`, `stringCopy`, `stringEquals`, etc. from `util/string.h` — never `strcmp`, `strcpy`, and friends directly.
|
|
- All functions that can fail return `errorret_t`. Use `errorThrow(...)`, `errorChain(call())`, and `errorOk()` macros — see `error/error.h`.
|
|
- Positions and game-world values use `fixed_t` (Q24.8 fixed-point, `int32_t`) — not `float`. Use `FIXED(x)` for literals and the `fixedFrom*`/`fixedTo*` helpers in `util/fixed.h`.
|
|
|
|
## Coding style
|
|
|
|
See [`.claude/style.md`](.claude/style.md) for the full style guide: indentation, line length, naming, typedefs, defines, include order, `const` usage, assertion placement, error handling, struct initialization, and platform conditionals.
|
|
|
|
## Architecture & systems
|
|
|
|
| Doc | Covers |
|
|
|---|---|
|
|
| [`.claude/architecture.md`](.claude/architecture.md) | Platform abstraction pattern, subsystem lifecycle, error handling, code-generation pipeline |
|
|
| [`.claude/display.md`](.claude/display.md) | Rendering pipeline: display state, screen, framebuffer, mesh, shader, texture, spritebatch, text |
|
|
| [`.claude/input.md`](.claude/input.md) | Input actions, buttons, bindings, axis helpers, events |
|
|
| [`.claude/asset.md`](.claude/asset.md) | Asset archive, entry lifecycle, loader types, async/sync split, low-level file I/O |
|
|
| [`.claude/ui.md`](.claude/ui.md) | UI element system, textbox, frames, loading overlay, fullbox transitions, FPS counter |
|
|
| [`.claude/animation.md`](.claude/animation.md) | Keyframe animation, easing functions |
|
|
| [`.claude/systems.md`](.claude/systems.md) | Time, threading, mutex, events, console, logging, system/platform, network |
|
|
| [`.claude/util.md`](.claude/util.md) | String, memory, math, fixed-point, array, sort, ref counting, CRC32, endian |
|
|
| [`.claude/save.md`](.claude/save.md) | Save slots, stream serialization with CRC, locale/i18n |
|
|
| [`.claude/rpg/index.md`](.claude/rpg/index.md) | RPG layer overview → [world](.claude/rpg/world.md), [entities](.claude/rpg/entity.md), [cutscenes](.claude/rpg/cutscene.md), [story/items](.claude/rpg/story.md) |
|
|
| [`.claude/display-refactor.md`](.claude/display-refactor.md) | Planned render-queue refactor (Saturn port context) |
|