CNA
View on GitHubA modern C++23 reimplementation of Microsoft XNA 4.0 with independent platform, audio and graphics layers.
Sample porting update. Existing ported samples are currently being reviewed. The remaining samples, including Racing Game, will be ported; web versions of all CNA samples are also in preparation.
First tagged release. This site documents the immutable v0.1.0-alpha.1 tag, whose C++ product version string is 0.1.0-alpha.1. It is an alpha release: public APIs may change before 1.0. The tag includes a read-side XNB loader, runtime glTF loading, XNA/FNA compiled Effect Framework bytecode on qualified renderers and an opt-in multi-renderer build mode. Its experimental C ABI 0.7.0 source surface is present but its final library target is compile-blocked by a missing NanoVG identity mapping. See Releases & versioning for the exact boundary.
Read capabilities narrowly. The 50 public renderer identities share 46 implementation families and are not equally complete. 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 effects are not universal: FNA3D supports them, while EasyGL, SDL_GPU and Vulkan require explicit build options; other renderers report the capability unavailable.
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.
Independent platform layer
CNA_PLATFORM selects SDL3, real SDL2, Headless or POSIX Terminal host integration. CNA_AUDIO_PLATFORM independently accepts SDL3, SDL2 or Null device integration. At alpha.1 only SDL3 enables SOUND_ENABLED and the SDL3_mixer-backed XNA playback/decoding path; SDL2 and Null are lower-level device/configuration surfaces, not equivalent game-audio mixers.
Pluggable Renderers
50 public renderer identities are implemented by 46 families. Single-renderer builds remain the compact default; compatible sets can be linked with CNA_GRAPHICS_RENDERERS and selected before device creation. The inventory spans mainstream GPU APIs, browser DOM/Canvas renderers, vector and historical DirectX paths, middleware and GPU-free CPU implementations.
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; Windows has portable and Windows-only renderer paths; Emscripten has WebGL, Canvas, DOM, SVG and PixiJS identities; macOS has native Metal CI. Android has NDK/source integration without an automatic gate. iOS is experimental and narrowly scoped to SDL_RENDERER: CI final-links a device app and launches a simulator smoke frame, but does not establish physical-device or pixel correctness.
Real .xnb Content Pipeline
A real read-side XNB loader is wired into ContentManager, including a built-in EffectReader, LZX decompression and shared-resource resolution. Built-in readers must be registered explicitly at startup. CNA reads content produced elsewhere; it does not include an XNB authoring pipeline.
PBR & Skeletal Animation
Beyond the six XNA stock effects, CNA ships non-XNA (CNAEXT) extensions: PbrEffect and SkinnedPbrEffect for physically based rendering, SkinnedModelEXT with AnimationPlayer and animation clips for skeletal animation, and MorphTargetEXT blend shapes. An offline glTF 2.0 converter is CNA's actual content path for models.
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 test and release history.
Verified Against Real XNA
A 39-scene oracle corpus is rendered by a real C#/XNA reference renderer and diffed pixel-exactly against CNA's DIRECTX9 output at zero tolerance, alongside differential testing against a running FNA build. 63 of the 86 official XNA 4.0 samples build on cna-samples, and CNA Craft plus the browser demos exercise the API under real game-code conditions.
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, Vulkan, SDL_Renderer, SDL_GPU, bgfx, Metal, FNA3D, native Direct3D 1–12, DirectDraw-shaped FreeDirect, browser Canvas/SVG/DOM, experimental WebGPU, or the GPU-free Software, PortableGL and Headless renderers at build time — without changing a line of game code.
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/Graphics/GraphicsDeviceManager.hpp"
#include "Microsoft/Xna/Framework/Graphics/SpriteBatch.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(CornflowerBlue);
spriteBatch_->Begin();
spriteBatch_->Draw(*logo_, 100.0f, 80.0f);
spriteBatch_->End();
getGraphicsDeviceProperty().Present();
}
private:
GraphicsDeviceManager graphics_;
std::unique_ptr<SpriteBatch> spriteBatch_;
std::unique_ptr<Texture2D> logo_;
};
int main() { MyGame game; game.Run(); }
Get Started →
Get running in 5 minutes
# 1. Clone CNA and its sibling repositories (these are NOT submodules)
git clone https://github.com/openeggbert/cna.git
git clone https://github.com/openeggbert/sharp-runtime.git
git clone https://github.com/openeggbert/easy-gl.git
git clone https://github.com/openeggbert/meta-gl.git
cd cna
git submodule update --init # non-recursive is correct, and much faster
# 2. System packages (FFmpeg is required on Linux/macOS, not optional)
sudo apt install cmake g++ ninja-build pkg-config \
libavcodec-dev libavformat-dev libavutil-dev libswresample-dev
# 3. Build (OPENGLES3 is the Linux default — needs OpenGL ES 3.0)
cmake -S . -B build -DCNA_GRAPHICS_RENDERER=OPENGLES3
cmake --build build --target CnaTests
# 4. Run the tests
ctest --test-dir build --output-on-failure
Full Getting Started Guide →
All Build Options →
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 checked against the public openeggbert GitHub account on 20 August 2026.
Release boundary: this site documents CNA 0.1.0-alpha.1. Companion repositories have their own branches and release cadence; a link here means “related and public”, not that its current default branch is guaranteed to build against this exact CNA tag. 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 tag'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 alpha.1 build requires this sibling checkout.
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 five EasyGL renderer identities. Clone both beside CNA when building those identities.
free-direct & free-api
Portable, game-driven compatibility layers for a narrow DirectX 3/DirectDraw and WinAPI-era surface. CNA's cross-platform FREEDIRECT renderer fronts free-direct, which in turn uses free-api.
FreeDirect game consumers
Planet Blupi is the portable original-source game that exercises free-direct and free-api on Linux and the web. Free Eggbert is a work-in-progress reconstruction of Speedy Eggbert 2. They are indirect CNA references: CNA's FREEDIRECT renderer shares the same compatibility-layer behavior they stress.
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.
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.
CNA.NET
The public C#/.NET binding project layers an XNA-compatible managed facade and an idiomatic CNA API over CNA's experimental native C ABI. The exact CNA alpha.1 C library cannot be built without correcting its missing NanoVG C identity, and the binding evolves independently, so check both sides before pairing releases.
cna-cs 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 through MonoGame to CNA. It consumes CNA directly and exercises a complete game across native desktop, MinGW/Wine, Android and Emscripten paths rather than an isolated framework sample.
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 Editor
An archived tooling experiment built on CNA's public API: scene/entity editing, asset import, 2D and wireframe 3D viewports, gizmos, a plugin surface and a separate live player process. It is useful design evidence, not part of CNA or a maintained alpha.1 toolchain.
cna-editor on GitHub ↗cna-samples
63 of 86 in-scope official XNA Game Studio 4.0 samples are ported and build. That repository has not changed since the preceding site audit. Build status is not a universal runtime claim: shader-heavy samples still depend on alpha.1's selected renderer, compiled-effect option and input format.
cna-samples on GitHub ↗cna-extended
A C++23 port of MonoGame.Extended, and the largest project in the ecosystem at ~65,000 lines. All 18 upstream subsystems are implemented, none of them skeletons — tilemaps (Tiled TMX, LDtk and Ogmo), particles, ECS, screens, tweening, collisions, bitmap fonts, input listeners, animations and more. It adds 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. 2,363 tests pass. Note its default build is headers-only — pass -DCNA_EXTENDED_LINK_CNA=ON to actually link.
cna-craft
A working port of Michael Fogleman's Craft — a creative-mode voxel sandbox with real multiplayer, not a Minecraft clone. 16³ chunks streamed by column, simplex terrain, 56 block types, a 27-neighbourhood ambient-occlusion meshing pass, an authoritative server speaking Craft's own ASCII wire protocol, and SQLite persistence of player edits. The cleanest codebase of the set: zero TODOs and zero stubs across 10,000 lines. Native builds work; the Emscripten build currently black-screens.
cna-craft 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. 60 demos are registered so far, covering Input (50) and Audio (10). Devices, Net, Media and both Graphics areas appear in the menu but are still empty, and there are no tests yet.
cna-examples on GitHub ↗cna-template
The starting point for a new CNA game. The C++ is deliberately tiny — 140 lines that load a texture and move it with the arrow keys — because the build wiring is the actual product: 9 CMake presets, a complete Android gradle project, MinGW-w64 cross-compilation, Emscripten asset preloading, Windows DLL deployment, a dependencies.lock pinning exact CNA and sharp-runtime commits, and CI across Linux, Windows, web and Android.
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 ↗OpenEggbert 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 immutable alpha.1 documentation snapshot.
openeggbert on GitHub ↗