What CNA offers
CNA provides a structured, incremental C++ implementation of the XNA 4.0 programming model. Below is a detailed overview of current and planned capabilities.
CNA is a work in progress. Features marked In Progress or Planned are not yet complete. See the Roadmap for current priorities.
XNA 4.0 API Implementation
CNA mirrors the Microsoft::Xna::Framework namespace hierarchy, translating XNA's C# API into idiomatic C++23.
Game Loop
The Game base class provides the familiar Initialize(), LoadContent(), Update(), and Draw() lifecycle. GameTime, GameComponent, and GameComponentCollection are implemented.
SpriteBatch
The primary 2D rendering abstraction. Supports Begin(), Draw(), and End() workflow. Backend-agnostic: game code is identical regardless of which rendering backend is selected.
Texture2D
Texture loading and management backed by SDL3_image. The Texture2D abstraction owns backend-specific GPU resources through the ITextureBackend interface.
GraphicsDevice
The central rendering device. Exposes Clear(), Present(), and viewport management. Delegates all backend work through IGraphicsBackend.
Math Types
Core math library: Vector2, Vector3, Vector4, Matrix, Quaternion, Color, Rectangle, Point, BoundingBox, BoundingSphere, BoundingFrustum, Plane, Ray, MathHelper.
Input
Input manager bridging SDL3 input events to XNA-style Keyboard, Mouse, and GamePad state APIs. SDL input bridge is implemented; higher-level XNA wrappers are in progress.
Audio
Audio surface built on SDL3_mixer. The SoundEffect and SoundEffectInstance abstractions are planned; foundational SDL3_mixer integration is in place.
Content Pipeline
XNA-style content loading through TitleContainer and TitleLocation. Full content pipeline support (compiled .xnb assets) is a longer-term goal.
SDL3 Foundation
SDL3 is the cross-platform foundation for windowing, input, audio, and surface lifecycle. CNA vendors SDL3 as a Git submodule — no system SDL packages are required.
Windowing & Events
SDL3 manages window creation, resizing, and the OS event loop. CNA wraps this through GameWindow and the Game run loop.
SDL3_mixer Audio
SDL3_mixer vendored as a submodule provides the audio backend. Mixer initialisation and basic playback are supported.
SDL3_image Loading
SDL3_image is used for loading PNG, JPG, and other texture formats into Texture2D. Vendored alongside SDL3.
Pluggable Rendering Backends
CNA separates the game-facing API from rendering implementation. A single CMake flag selects the backend at build time; all game code remains unchanged.
SDL_Renderer Backend
The most portable 2D backend. Uses SDL3's built-in hardware-accelerated renderer. Best for straightforward 2D workflows and broad platform compatibility. Selected with -DCNA_GRAPHICS_BACKEND=SDL_RENDERER.
EasyGL (OpenGL) Backend
Custom shader-driven rendering via the easy-gl helper library. Provides finer control over rendering behaviour and extensibility than the fixed SDL renderer. Selected with -DCNA_GRAPHICS_BACKEND=EASYGL.
bgfx Backend
Integration with the bgfx cross-platform graphics library (Vulkan, Metal, DX11/12, OpenGL). Integrated through CMake FetchContent. Implementation is ongoing. Selected with -DCNA_GRAPHICS_BACKEND=BGFX.
Vulkan Backend
Architecture scaffold exists. Full Vulkan implementation is a future milestone — currently contains stub/TODO areas. Selected with -DCNA_GRAPHICS_BACKEND=VULKAN.
Cross-Platform Architecture
CNA's SDL3 foundation makes it possible to target multiple operating systems and hardware platforms from a single codebase.
Linux (x86_64)
Primary development platform. GCC 12+ and Clang 15+ both tested. Both EASYGL and SDL_RENDERER backends are validated on Linux x86_64.
Windows (x86_64)
Supports MSVC 2022, clang-cl, and MinGW-w64 (including Linux-to-Windows cross-compilation). SDL_RENDERER backend validated on Windows.
Android
Android is an architectural target. SDL3 supports Android natively. CNA's backend abstraction is designed to accommodate it. Requires CMake toolchain configuration for the Android NDK.
Emscripten / Web
WebAssembly via Emscripten is architecturally possible through SDL3's Emscripten support. Web builds are a future milestone that would enable browser-based demos and distribution.
Nova-3D Foundation
CNA is designed from the ground up as the portable runtime and rendering abstraction layer for the Nova-3D engine — a higher-level, opinionated 3D engine that will build on CNA's foundations. The clean API separation between game-facing code and backend implementations makes this composition possible without coupling.
Modern C++23 Codebase
C++23 Standard
CNA targets C++23 throughout. Requires GCC 12+, Clang 15+, or MSVC 2022 v17.8+.
CMake Build System
CMake 3.20+ with FetchContent for bgfx, vendored SDL3 submodules, and GoogleTest for the test suite.
Test Suite
GoogleTest-based test suite (CnaTests target). Run with ctest --test-dir build.