CNA
A modern C++ reimplementation of the Microsoft XNA 4.0 API, built on SDL3 with a pluggable rendering backend layer.
Early development notice: CNA is actively developed but not yet production-ready. XNA 4.0 API coverage is partial and growing incrementally. APIs and internals are subject to change. It is suitable for experimentation, engine research, and contributing — not for shipping production games yet.
XNA 4.0 for the modern C++ era
CNA brings the beloved XNA programming model to native C++, without a managed runtime, built on the solid cross-platform foundation of SDL3.
XNA-Compatible API
Public API follows XNA namespaces and patterns — Microsoft::Xna::Framework — so XNA knowledge transfers directly to CNA.
SDL3 Foundation
SDL3 provides the cross-platform layer for windowing, input, audio, and surface management. No system SDL packages required — built from vendored submodules.
Pluggable Backends
Select a rendering backend at build time: SDL_RENDERER, EASYGL (OpenGL), BGFX, or VULKAN. Game code stays the same.
Native C++23
Full control over memory, lifetimes, and rendering. No garbage collector, no managed runtime — pure native performance.
Cross-Platform Direction
Linux and Windows supported today. Android and Emscripten (WebAssembly) are architectural targets for future milestones.
Nova-3D Foundation
CNA is designed to serve as the internal runtime base for the Nova-3D engine — a higher-level engine built on top of the CNA framework layer.
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 →
Related projects & references
CNA draws inspiration from the XNA ecosystem and related open-source efforts.
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 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 ↗cna-demo
Demo application showcasing CNA capabilities. Contains runnable examples targeting multiple platforms and rendering backends.
⚠ TODO: add cna-demo link