Internals
Evidence basis: source-verified at the pinned commit. Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. This hub only organises the pages below it.
Internals pages are source tours: they follow one subsystem from construction to teardown through the code as it stands at snapshot 009d40f5, naming the types, functions, ownership rules, failure modes, CMake wiring and tests involved. They answer “how does this actually work?”; the Maintainer Handbook answers “how do I change it safely?”.
How an internals page is organised
A page is only useful to a maintainer if it can answer the same questions for every subsystem. The pages in this section are written to cover, where the subsystem has them:
- Purpose and boundary — what the subsystem owns and what it deliberately does not.
- Important types and their relationships, and its dependencies.
- Construction and ownership — who creates, retains, borrows and destroys each object.
- Runtime path and state — the normal call flow and the mutable state it touches.
- Threading — which thread may call what, and which barriers are actually proven in the source.
- Failures — guards, exceptions, rollback, and whether an attempt can be retried.
- Destruction — the order that matters, and why.
- Invariants that later edits must not break.
- Test evidence and gaps — the tests that exist, what each can and cannot show, and what has no test.
- Realistic changes and the other subsystems they touch, and a curated reading order through the source.
Diagrams on these pages describe actual paths in the source, not a wish. A page states its evidence basis under its title: source-verified means checked by reading the pinned source; a test being named means it exists, not that it was run.
The internals map
| Area | Pages | What they establish |
|---|---|---|
| Runtime | Runtime module · Startup · One frame · Ownership & shutdown | Game construction order, the run loop, and the destruction chain that keeps the platform alive for the longest. |
| Graphics | Renderer selection · GraphicsDevice · Indexed draw · Textures & targets · Family map | How an identity becomes a renderer, what GraphicsDevice owns, and what one draw call does from the public API to a backend. |
| Renderer families | EasyGL · OpenGL4 · Vulkan · SDL_gpu · Software · Headless · Stub | The backend-specific resource translation, draw execution, presentation and teardown of seven of the 21 implementation families. |
| Platforms | Overview · SDL3 · SDL2 · X11 · Wayland · Win32 · Headless · Terminal | Window, event and input ownership, native handles and surfaces handed to renderers, scaling and shutdown for each of the seven CNA_PLATFORM implementations. |
| Audio | Audio engine | SoundEffect and instances, the mixer, and the SDL3, SDL2, Null and ALSA transports with their callback barriers. |
| Content | Content runtime · Content pipeline | How ContentManager resolves XNB, CNB and loose assets, and how the build-time pipeline produces them. |
| Input | Events & snapshots | The split between platform events and the per-frame public snapshots, backend by backend. |
| Modules | Core · Math · Design · Storage · Media · FFmpeg video · Devices · Device host services · Diagnostics · Inspector · Phone · Gamer services · Graphics extensions · Networking | Ownership, lifetime and boundary rules of the smaller production modules. |
| C API & bindings | C API · C# · Java · Python | The opaque-handle and error boundary of the experimental C ABI, and how three language bindings own native objects. |
Which modules and renderer families have a dedicated page, and which do not yet, is tabulated mechanically in the generated module index. The maps one level up — how the layers fit together — are the Architecture maps.
Reading orders by goal
| If you need to… | Read, in this order |
|---|---|
| Understand a frame end to end | Startup → One frame → Shutdown → GraphicsDevice → Indexed draw |
| Change or add renderer behaviour | Renderer selection → GraphicsDevice → Resources → Indexed draw → the family page → a sibling family for comparison |
| Work on a platform backend | Platform overview → SDL3 (the default platform) → the backend you will touch → Input events |
| Change asset loading or authoring | Content runtime → Content pipeline → Storage |
| Reason about teardown and callbacks | Ownership map → Thread & callback map → Shutdown → Audio engine |
| Change a public API that bindings mirror | the owning module page → C API → a binding page → Update the C API |
Deep dives on this topic
Long-form pages that explain the exact semantics, invariants and evidence behind this subject.
- Glossary of XNA and CNA terms — Checked definitions of the XNA and CNA terms used across libcna.com, grouped by subject, each correcting common older readings and linking to the page with the detail.
Related pages
The same subsystem is explained at four altitudes. These are the neighbouring pages at each one.
- User guide
- Documentation
- Architecture
- How CNA is structured · Architecture maps
- Maintainer workflow
- Maintainer Handbook · Human Takeover
- Tests and validation
- Test architecture
- Reference
- Module index