Snapshot c1c316b9 · post-alpha.1 development · 9 October 2026

CNA

View on GitHub

A modern C++23 reimplementation of Microsoft XNA 4.0 with independent platform, audio and graphics layers.

CNA now has a Blog. Its articles describe different areas of CNA. Link: blog.libcna.com.

XNA samples, in C++ and in the browser. The C++ port of Microsoft’s XNA 4.0 samples is practically complete: 91 sample and game projects run as native C++ CNA programs, and 90 C++ builds are playable in your browser at samples.libcna.com. The Racing Game Kit is ported too, but not hosted. The original C# samples also run unchanged on CNA.NET. How these numbers are counted.

CNA actively maintains C and C# bindings. CNA itself is written in C++23, its native implementation language. The experimental C ABI (0.46.0, opt-in build) exposes that implementation to other languages, and C# through CNA.NET is built on it: a Microsoft.Xna.Framework-compatible facade over the same native runtime, so existing XNA 4.0 C# game source often runs without being rewritten. CNA.NET is beta and pairs with exactly this ABI version.

Archived language bindings: CNA also has eight further bindings — Common Lisp, Go, Java, Python, Ruby, Rust, Swift and TypeScript — several of them well advanced. They are archived in CNA Lab because keeping them current with a fast-moving pre-1.0 ABI took too much time, and may be revived if there is community interest.

Ms-PL  ·  C++23  ·  pre-1.0 API  ·  commit c1c316b9 (after tag v0.1.0-alpha.1)

0.1.0
alpha.1 version string
3,687
Commits since the alpha.1 tag
14
Renderer identities
12
Implementation families
3
Platform implementations
3
Audio platform choices
11,380
Static test definitions
7
Renderer test trees passing on a physical Mac mini M4
3,627 / 3,627
XNA runtime members represented
91
C++ sample ports complete
90
Samples playable in the browser
84
Original C# sample programs on CNA.NET
18
CI workflow files
⚠

Development snapshot, not a release. This site documents CNA commit c1c316b9 (9 October 2026, branch apple/m4-stabilization), 3,687 commits after the v0.1.0-alpha.1 tag. CNA’s own version string is still 0.1.0-alpha.1 and public APIs may change before 1.0. Since the tag CNA gained a curated 14-renderer set, SDL3 as its one windowing platform (Windows, X11 and Wayland through SDL’s video drivers), ALSA audio, a build-time Content Pipeline that writes XNB and the new CNB format, an XNA Design module, Diagnostics and an Inspector, service-backed Gamer Services with an optional server, and an experimental C ABI now at 0.46.0 that the C# binding CNA.NET is built on (the ABI’s release gate still reports “Not ready”). This snapshot has also been tested on a physical Mac mini M4 and in the iOS Simulator (see macOS and iOS). GitHub’s default branch still points at the alpha.1 commit, so clone apple/m4-stabilization to follow this documentation. See Releases & versioning for the exact boundary.

📝

Read capabilities narrowly. The 14 public renderer identities share 12 implementation families and are not equally complete: one, SDL_RENDERER, is deliberately 2D-only. A normal build contains one renderer; CNA_GRAPHICS_RENDERERS can opt into several compatible families and GraphicsRendererSelection chooses one before the first device. Platform host integration (CNA_PLATFORM), audio I/O (CNA_AUDIO_PLATFORM), graphics rendering and the target operating system are separate axes. Compiled XNA effects are not universal: FNA3D supports them by default and eight more renderer families need an explicit build option, so a default build reports the capability on one identity only. The default Reach graphics profile is enforced on every renderer, so MRT, occlusion queries and float targets require HiDef.

XNA 4.0 for the modern C++ era

CNA brings the XNA programming model to native C++ without a managed runtime, while keeping host integration, audio and graphics independently selectable.

⚙

XNA-Compatible API

Public API follows XNA namespaces and patterns - Microsoft::Xna::Framework - so XNA knowledge transfers directly to CNA. All 3,627 documented XNA 4.0 runtime members across 331 types are represented in the public headers (representation, not a claim of identical behavior), and the previously missing Framework.Design converters now exist as an opt-in module. See XNA Compatibility.

🔗

Independent platform layer

CNA_PLATFORM selects one of three host integrations: SDL3 (default), the one windowing implementation, which reaches Windows, X11, Wayland, macOS, iOS, Android and the browser through SDL’s own video drivers, or the windowless Headless and POSIX Terminal hosts. CNA_AUDIO_PLATFORM independently accepts SDL3, ALSA (CNA’s own mixer) or Null; SDL3 and ALSA enable SOUND_ENABLED and the XNA playback engine. CNA_ENABLE_SDL=OFF builds a windowless binary without SDL entirely. See Platforms.

🌐

Pluggable Renderers

14 public renderer identities are implemented by 12 families. Single-renderer builds remain the compact default; compatible sets can be linked with CNA_GRAPHICS_RENDERERS and selected before device creation. The set spans OpenGL ES 3, desktop OpenGL 3.3, WebGL 2, Vulkan, SDL_GPU, WebGPU, Metal, FNA3D, Direct3D 9 and 11, SDL_Renderer, and the GPU-free Software, Headless and Stub implementations. See Renderers.

🏅

Native C++23

Full control over memory, lifetimes, and rendering. No garbage collector, no managed runtime - pure native performance.

🖥

Cross-Platform

Linux is the primary development host (SDL3 on X11 or Wayland); Windows runs through SDL3’s Windows driver with the Direct3D 9 and 11 renderers, whose native CI lanes are manual; the browser is a real CNA platform through Emscripten, with WEBGL2 and experimental WEBGPU — see the 90 playable sample builds. macOS was tested on a physical Mac mini M4: seven renderer trees, native METAL among them, passed their full test suites with no failure (presentation was not observed on screen; no Intel Mac was run). iOS is experimental: SDL_RENDERER and METAL run in the iOS Simulator with an exact pixel probe and the device build final-links, but no physical iPhone or iPad has run CNA. Android has NDK/source integration without an automatic gate; real games and samples have been run on the Android emulator.

📦

Real .xnb Content Pipeline

A real XNB loader is wired into ContentManager with 61 built-in readers, LZX decompression and shared-resource resolution, and the load ladder now tries .xnb, then CNA’s .cnb, then loose files. New since alpha.1: the build-time Content Pipeline (cna-content, importers, processors and a .contentproj workflow) writes XNB and CNB, so CNA no longer depends on XNA or MonoGame tooling to author content. See the CNB format.

✨

PBR & Skeletal Animation

Beyond the XNA stock effects, CNA ships non-XNA (EXT) extensions: PbrEffect and SkinnedPbrEffect for physically based rendering with shadow and image-based-lighting inputs, SkinningData with AnimationPlayer and animation clips (the Avatar path has its own SkinnedModelEXT), and MorphTargetEXT blend shapes. Runtime glTF 2.0 loading works without a tooling step; the offline converter remains available. The opt-in CNAEXT module adds retro post-processing effects (ASCII, CRT and colour-depth reduction) and debug drawing. See CNAEXT extensions.

🔧

Built on sharp-runtime

CNA rests on sharp-runtime, a C++23 implementation of a practical .NET BCL subset covering System::Collections, IO, Text (including JSON and regular expressions), Net, Threading, Xml, Globalization and Numerics. It is a required sibling checkout with its own independently moving history — this CNA snapshot needs sharp-runtime’s apple/m4-stabilization branch, not its default branch.

🎮

Verified Against Real XNA

A 39-scene oracle corpus of reference images captured from the genuine XNA 4.0 runtime (run under Wine with DXVK on Linux) is compared with CNA’s DIRECTX9 output at zero tolerance. The repository records all 39 scenes as pixel-exact on that path (the last consolidated report covers 31, later per-scene notes record the rest, and nothing was re-run for this site); the other renderers are held to a narrower bar, and none of this runs in CI. A running FNA build provides value-level differential checks. Real XNA programs are the other half of the evidence: 91 of Microsoft’s XNA 4.0 samples and games have complete C++ ports (cna-samples revision 5db32e6), 90 of them play in the browser, and 84 original C# sample programs run unchanged through CNA.NET. See the Showcase and Verification.

📈

Diagnostics & Inspector

New since alpha.1: CNA_DIAGNOSTICS (OFF, STATS or FULL) records frame, resource and renderer statistics, and the opt-in Inspector exposes a running game to a browser UI through an authenticated local agent. Both are off by default and no CI lane builds them yet. Start with Diagnostics.

#

C# through CNA.NET

C++ is CNA’s implementation, and its C ABI opens it to other languages. CNA.NET builds on that ABI: CNA.XnaCompat exposes the Microsoft.Xna.Framework API, so existing XNA 4.0 C# source compiles against CNA’s native runtime, usually without changes to the game code. It targets source compatibility, not Microsoft’s binaries, and is beta. Start a new game from the dotnet new template or migrate an XNA, FNA or MonoGame game.

🎮

Runs in the browser

WebAssembly is a first-class CNA target, not a screenshot gallery: 90 C++ ports of Microsoft’s XNA samples are playable at samples.libcna.com, and more games are on the Demos page. Saves persist in the browser’s storage, and games that start threads have a threaded build. CNA.NET has its own browser host for C# games, so far qualified in headless Chromium.

🏅

Gamer Services & Avatars

XNA’s GamerServices, Guide, avatars and NetworkSession work offline with local profiles, and can optionally connect to the self-hosted CNA Gamer Services server for accounts and sign-in, friends and presence, achievements and leaderboards, messages, parties, avatars and relayed online sessions with invitations and host migration. The server is CNA’s own and not Xbox LIVE compatible. See Gamer Services & Avatars.

Why CNA?

CNA fills a specific gap: there is no other mature native C++ reimplementation of the XNA 4.0 API.

No managed runtime

C++ avoids GC pauses, managed heap overhead, and JIT warmup. Useful for performance-critical or embedded scenarios where .NET is unavailable.

Familiar API

The XNA programming model is genuinely good design. CNA preserves it in C++ — if you know XNA or MonoGame, you'll be productive in minutes.

Pluggable renderers

Swap between OpenGL ES 3, desktop OpenGL 3.3, Vulkan, SDL_Renderer, SDL_GPU, Metal, FNA3D, native Direct3D 9 and 11, browser WebGL 2, experimental WebGPU, or the GPU-free Software and Headless renderers at build time — without changing a line of game code, and with several linked into one binary if you opt in.

Familiar XNA-style game loop

If you know XNA or MonoGame, CNA will feel immediately recognisable - just in native C++.

#include "Microsoft/Xna/Framework/Game.hpp"
#include "Microsoft/Xna/Framework/GraphicsDeviceManager.hpp"
#include "Microsoft/Xna/Framework/Graphics/SpriteBatch.hpp"
#include "Microsoft/Xna/Framework/Graphics/Texture2D.hpp"

using namespace Microsoft::Xna::Framework;
using namespace Microsoft::Xna::Framework::Graphics;

class MyGame final : public Game {
public:
    MyGame() : graphics_(this) {}

protected:
    void LoadContent() override {
        spriteBatch_ = std::make_unique<SpriteBatch>(getGraphicsDeviceProperty());
        logo_ = std::make_unique<Texture2D>("assets/logo.png", getGraphicsDeviceProperty());
    }

    void Draw(const GameTime& gameTime) override {
        getGraphicsDeviceProperty().Clear(Color::CornflowerBlue);
        spriteBatch_->Begin();
        spriteBatch_->Draw(*logo_, 100.0f, 80.0f);
        spriteBatch_->End();
        Game::Draw(gameTime); // draws components; Game presents the frame after Draw returns
    }

private:
    GraphicsDeviceManager graphics_;
    std::unique_ptr<SpriteBatch> spriteBatch_;
    std::unique_ptr<Texture2D> logo_;
};

int main() { MyGame game; game.Run(); }
Get Started →

Get running from source

# 1. Clone CNA's documented branch and its sibling repositories (these are NOT submodules).
#    GitHub's default branch of cna is still the alpha.1 commit; sharp-runtime and meta-gl use
#    their branches of the same name, easy-gl its default branch.
git clone -b apple/m4-stabilization https://github.com/libcna/cna.git
git -C cna checkout c1c316b9c7a846ce8002809c151fcd1af14942c9
git clone -b apple/m4-stabilization https://github.com/libcna/sharp-runtime.git
git clone https://github.com/libcna/easy-gl.git
git clone -b apple/m4-stabilization https://github.com/libcna/meta-gl.git
cd cna
git submodule update --init          # non-recursive is correct, and much faster

# 2. System packages. FFmpeg is optional now (video throws NotSupportedException without it).
#    Install the X11/GL/audio development headers BEFORE the first configure so the vendored SDL3
#    gets real window and audio drivers; CI installs, on top of the basics below (abridged; the full list is on the Building page):
#    libx11-dev libxext-dev libxrandr-dev libxi-dev libxcursor-dev libxkbcommon-dev
#    libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libvulkan-dev libasound2-dev libpulse-dev libdbus-1-dev
sudo apt install cmake g++ ninja-build pkg-config

# 3. Configure and build (OPENGLES3 is the Linux default - needs OpenGL ES 3.0).
#    The first configure also builds SDL3 from source, so allow a few minutes.
cmake -S . -B build -DCNA_GRAPHICS_RENDERER=OPENGLES3
cmake --build build --target cna_demo_2d

# 4. Build one of the 22 focused test targets (CnaMathTests, CnaContentTests, CnaInputModuleTests, ...).
#    Many CTest entries are separate executables and GPU tests need a display: the build guide
#    explains the CNA_TEST_DISPLAY policy and how to run them under xvfb-run.
cmake --build build --target CnaMathTests
Full Getting Started Guide → All Build Options → Development & Maintainer Guide → Deep Dives → Known Issues →

Related projects & references

CNA sits in a larger public ecosystem: required runtime layers, renderer libraries, starter projects, ports, tools, games and primary XNA references. The links below were re-checked against GitHub on 4 October 2026, including the public openeggbert GitHub account; several stale or dead links were corrected.

🔗

Release boundary: this site documents CNA snapshot c1c316b9. Companion repositories have their own branches and release cadence; a link here means “related and public”, not that its current default branch builds against this exact snapshot. Numbers on these cards are tied to the named repository revision, not to CNA. Required sibling checkouts for a chosen CNA configuration are identified separately in the build guide.

📝

CNA is partially based on FNA (C#). Portions of CNA's API design and implementation are derived from FNA - a managed C# reimplementation of XNA 4.0 by Ethan Lee, licensed under the Ms-PL. CNA translates these portions into native C++23. See About and the snapshot's THIRD_PARTY_NOTICES.md for full attribution.

Microsoft XNA 4.0 Documentation

The original XNA Game Studio 4.0 API documentation on Microsoft Learn - the reference CNA aims to be compatible with.

Microsoft Learn ↗

FNA

FNA is a reimplementation of the Microsoft XNA Game Studio 4.0.4 libraries, targeting C#/.NET. CNA shares the Ms-PL licence and portions derived from FNA.

FNA Docs ↗

MonoGame

MonoGame is a cross-platform successor to XNA for C#. Its documentation is a valuable reference for understanding the XNA API surface.

MonoGame Docs ↗

sharp-runtime

The C++23 implementation of the practical System.* surface used throughout CNA: value types, strings, collections, IO, text, threading, XML, JSON and more. Every build of this snapshot requires this sibling checkout, and it must be the repository’s apple/m4-stabilization branch (its default branch lacks the components CNA now requests).

sharp-runtime on GitHub ↗

easy-gl & meta-gl

meta-gl supplies type-safe OpenGL/OpenGL ES loading and calls; easy-gl adds the toolkit-independent object layer used by CNA's three EasyGL renderer identities. Clone both beside CNA when building those identities.

easy-gl ↗ meta-gl ↗

Easy3D

A deliberately small companion library for CNA projects that need practical cameras, billboard/cube batching, texture atlases and debug drawing without hiding CNA behind a separate engine abstraction. It lives in the openeggbert account.

easy-3d on GitHub ↗

CNA glTF Viewer

A focused desktop viewer for .gltf and .glb assets. It exercises both CNA’s direct runtime glTF path and the cna_tool_gltf_to_cnj conversion path, including materials, skins and animation playback. The working code is on the repository’s develop branch.

cna-gltf-viewer on GitHub ↗

CNA.NET

CNA’s C# binding: a Microsoft.Xna.Framework-compatible facade (CNA.XnaCompat) over an idiomatic managed API and an internal P/Invoke layer that talks only to CNA’s C ABI. It is beta and source-first; it admits exactly C ABI 0.46.0, the version this snapshot exports, after a compatibility review recorded by CNA’s Apple campaign, and on a physical Mac mini M4 (osx-arm64) its suites, package acceptance, template and samples ran locally. Companion repositories: cna-dotnet-template (a dotnet new template with desktop, browser and Android heads), cna-dotnet-samples (the original XNA C# samples, unchanged) and cna-multi-language-3d-demo (one game in C++, C and C#).

CNA.NET overview cna-dotnet on GitHub ↗

Galaxy Eggbert

A playable 3D game and editor built directly on CNA with Easy3D helpers. It provides a substantial real-game consumer for terrain, models, UI, audio, persistence and authoring workflows beyond isolated samples.

galaxy-eggbert on GitHub ↗

Mobile Eggbert

A C++ migration of the 2013 Windows Phone XNA game (Speedy Blupi), decompiled from the original release, moved through MonoGame and then onto CNA. It consumes CNA directly, builds natively on desktop from source, has an Android Gradle/NDK project (no APK is published) and a playable browser build. Its results belong to the CNA revision it was built with, not to this snapshot.

mobile-eggbert on GitHub ↗

MeshCraft

A C++23 scene editor and conversion toolchain for editable MC3 scenes and glTF/GLB output. Its graphical editor has a CNA rendering path, while its command-line converters can run without CNA.

mesh-craft on GitHub ↗

cna-samples

91 C++ ports of Microsoft’s XNA Game Studio 4.0 samples and games are complete in the repository’s own plan (revision 5db32e6, 3 October 2026), and 90 C++ builds are published as playable browser builds. The plan audits 153 entries (SAMPLE-001 to SAMPLE-153), not 153 games: 8 relevant XNA 4.0 C# programs remain, and 54 entries are not port targets (XNA 3.x or older, Silverlight, WinForms tools, VB.NET, C++, asset packs). The Racing Game Kit is ported in its own plan and is not hosted. These are results for CNA next on that date, not for this snapshot. Shader-driven samples such as Bloom, ShadowMapping and Skinning run through CNA’s compiled-effect path.

cna-samples on GitHub ↗ Play samples ↗

CNA Car Simulator

A realistic passenger-car driving simulator in a fictional Czech landscape, built on CNA next and sharp-runtime next, with traffic, weather, a day-night cycle and a helicopter. Playable in the browser; two videos on the CNA YouTube channel.

Play in Browser ↗ cna-car-simulator on GitHub ↗

CNA Street

A procedurally generated European inner-city street — a signalised junction, traffic, pedestrians, shadows and reflections — rendered with CNA. The web build generates the street in your browser, so the first start takes about a minute.

Play in Browser ↗ cna-street on GitHub ↗

cna-lab

A collection of experimental CNA projects kept as git subtrees — among them black-pine, tamagotchi-cna and wolf-cna, several of which share their names with browser builds on the Demos page. It is also the archive of CNA’s eight archived language bindings (under bindings/), with their templates and full history.

cna-lab on GitHub ↗

cna-extended

A C++23 port of MonoGame.Extended with about 100,000 lines of C++ (102,360 lines in 890 files at revision 5775ecc97). All 18 upstream subsystems are implemented — tilemaps (Tiled TMX, LDtk and Ogmo), particles, ECS, screens, tweening, collisions, bitmap fonts, input listeners, animations and more — plus a non-upstream World3DEXT layer: an ECS-based 3D renderer with frustum culling, skinned models, octree and spatial-hash broadphases, a 3D particle system and voxel tilemaps. Its default build is headers-only — pass -DCNA_EXTENDED_LINK_CNA=ON to actually link. The working code is on the develop branch.

cna-extended on GitHub ↗

cna-examples

A single browsable catalogue app that teaches CNA’s own APIs, one demo screen at a time — Home → Area → Category → Demo, navigable at runtime with no rebuild. At revision ea33c9a29 (13 September 2026) the catalogue registers 249 demo screens across 13 areas, all populated, with a catalogue checker and a headless sweep tool; its README reports all 249 rendering on both OPENGLES3 and SDL_RENDERER.

cna-examples on GitHub ↗

cna-template

The starting point for a new CNA game. The C++ is deliberately tiny — a HelloGame that loads a texture and moves it — because the build wiring is the actual product: per-renderer CMake presets, a complete Android gradle project, MinGW-w64 cross-compilation, Emscripten asset preloading, Windows DLL deployment and a dependencies.lock pinning exact CNA and sharp-runtime commits. Its public revision pins CNA from 11 August 2026 and its weekly CI is currently red, so treat it as a template to adapt, not as a verified build of this snapshot.

cna-template on GitHub ↗

xna4-spec

A machine-readable XML catalogue of the XNA 4.0 API surface, scraped from Microsoft's original documentation and validated against a hand-written schema. It is useful as a checklist of namespaces, types and members, but its one-line summaries do not define runtime semantics or conformance. CNA does not consume it at build time.

xna4-spec on GitHub ↗

CNA ecosystem map

The public umbrella repository explains how CNA, sharp-runtime, rendering layers, tools and preservation projects fit together. Use it to discover adjacent work; its moving project summaries are not the source of truth for this documentation snapshot.

libcna on GitHub ↗