ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
ObjectivelyMVC

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:

Outlet outlets[] = MakeOutlets(
MakeOutlet("apply", &this->apply),
MakeOutlet("slider", &this->slider)
);
View *panel = $$(View, viewWithResourceName, "Settings.json", outlets);
$(self->view, addSubview, panel);
this->apply->delegate.didClick = didClickApply;
static void addSubview(View *self, View *subview)
Definition PageView.c:49
#define MakeOutlet(identifier, view)
Creates an Outlet with the specified parameters.
Definition View+JSON.h:230
#define MakeOutlets(...)
Creates a NULL-termianted array of Outlets.
Definition View+JSON.h:235
static View * viewWithResourceName(const char *name, Outlet *outlets)
Definition View.c:1891
Outlets enable outbound data binding of Views through JSON.
Definition View+JSON.h:200
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Definition View.h:134

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)
Definition Control.c:266
static void render(View *self, Renderer *renderer)
Definition Control.c:179
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