Object oriented MVC framework for SDL3 and C.
View on GitHub — Zlib license.
About
ObjectivelyMVC is a cross-platform user interface and interaction framework for games built with SDL3 and GNU C. It renders via SDL3's GPU API (Metal, Vulkan, Direct3D 12) through ObjectivelyGPU, and is built on Objectively. It is the user interface framework used in Quetoo.
Features
- Does not hijack your main loop — call
respondToEvent and render once per frame
- Complete widget set: Button, Checkbox, Slider, Select, TextView, TableView, CollectionView, TabView, PageView, and more
- Programmatic or JSON-driven layouts for declarative, data-driven UI
- Fully themable via a CSS-inspired Selector / Style / Stylesheet system
- High-DPI / 4K ready — automatic Retina detection with SDL_ttf TrueType font rendering
- iOS and macOS (xcframework), Windows (MSVC / ClangCL), and Linux
tl;dr
Describe an entire interface in JSON and inflate it with a single call — outlets bind the named Views straight into your controller:
);
this->apply->delegate.didClick = didClickApply;
static void addSubview(View *self, View *subview)
#define MakeOutlet(identifier, view)
Creates an Outlet with the specified parameters.
#define MakeOutlets(...)
Creates a NULL-termianted array of Outlets.
static View * viewWithResourceName(const char *name, Outlet *outlets)
Outlets enable outbound data binding of Views through JSON.
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
And ObjectivelyMVC never hijacks your main loop. Your game owns the window, the GPU device and the events; you simply hand it each event and a frame to draw into:
...
static void respondToEvent(View *self, const SDL_Event *event)
static void render(View *self, Renderer *renderer)
static WindowController * windowController(SDL_Window *window)
Getting Started
Consult the Installing ObjectivelyMVC for dependencies, building, and linking.
User Guide
Consult the ObjectivelyMVC User Guide [User Guide] to build your first interface.
Class Hierarchy
Browse the Class Hierarchy to navigate the full API.
Examples
ObjectivelyMVC demo