API Overview

SafiEngine API

SafiEngine is a pure-C game engine built on SDL3 (with the SDL_gpu API), flecs for ECS, cglm for math, MicroUI for the debug overlay, and cgltf for model loading. Every subsystem below ships as part of the engine and is available by including <safi/safi.h> (umbrella header) or individual <safi/…/…> headers.

Zero setup

All dependencies are pulled in by CMake FetchContent. You only need CMake and a C/C++ compiler — no manual brew install, no submodules, no shader toolchains.

Subsystems

AreaHeader prefixDescriptionStatus
Core<safi/core/…>SafiApp, logging, frame timingImplemented
Scheduler<safi/ecs/…>Startup, update, fixed-update, render stagesPartial
ECS<safi/ecs/…>flecs world, stock components, systemsImplemented
Transform<safi/ecs/…>Local/global transform, hierarchy propagationPartial
Camera<safi/ecs/…>Pose (eye/forward/up), active-camera tag, screen-rayImplemented
VisibilityVisibility flags, frustum culling, render layersWIP
Render<safi/render/…>SDL_gpu renderer, meshes, materials, shaders, glTFImplemented
Primitives<safi/render/…>Procedural plane/box/sphere/capsule with color + textureImplemented
Lighting<safi/render/…>Directional, point, ambient lightsWIP
Gizmos<safi/render/…>Frame-lifetime line/wireframe overlay for editor toolsImplemented
Assets<safi/render/…>Asset handles, caching, hot-reload stubImplemented
Scene<safi/scene/…>JSON save/load/clear, in-memory snapshot/restoreImplemented
Editor<safi/editor/…>Edit/Play toolbar, fly-cam, translate/rotate/scale gizmoPartial
Input<safi/input/…>Keyboard/mouse/scroll/modifiers snapshot singletonImplemented
UI<safi/ui/…>MicroUI debug overlayImplemented
PhysicsColliders, rigid bodies, raycasts, overlap queriesPartial
Audio<safi/audio/…>2D/3D playback, mixer buses, streamingImplemented
Feature status

See the full Feature Roadmap for a detailed breakdown of every feature's implementation status.

Quickstart

main.c
#include <safi/safi.h>

int main(void) {
    SafiApp app;
    safi_app_init(&app, &(SafiAppDesc){
        .title = "Hello SafiEngine",
        .width = 1280,
        .height = 720,
        .vsync = true,
        .enable_debug_ui = true,
    });

    // register components, systems, spawn entities...

    safi_app_run(&app);
    safi_app_shutdown(&app);
}

See the full runnable example at SafiEngine/examples/gltf_viewer/main.c.

Core

ECS

Render

Scene

Editor

Project

Audio

Input

UI