Level 0, a view

isolen_run is the whole of main. It parses the standard arguments, opens the window and the device, calls your view whenever a frame is needed, and returns the process exit code once the window closes.

main.cpp
#include "isolenui/app/app.h"
#include "isolenui/kit/kit.h"

// level zero never touches a window or a frame, it only gets a view callback
// the engine runs whenever something on screen could have changed
static void draw(isolen_frame* f, void* user)
{
    (void)user;
    ui::ctx* u = f->ui;
    // the shell body is already a ui::view, so this column scrolls with it
    // once the window is too short for it
    ui_box(u, ui::col().pad(24.0f).gap(12.0f))
    {
        ui::text(u, "isolen ui", ui::head(u));
        ui::text(u, "a presentation engine's element and layout api",
                 ui::body(u));
        if (ui::button(u, "quit")) {
            isolen_quit(f->app);
        }
    }
}

int main(int argc, char** argv)
{
    isolen_app_desc d = isolen_app_defaults();
    d.title = "isolen ui demo";
    d.width = 1280;
    d.height = 720;
    d.view = draw;
    return isolen_run(&d, argc, argv);
}

What the view receives

The view is an isolen_view_fn: it takes an isolen_frame* and the user pointer from the description. The frame carries everything this tick needs:

  • ui is the context to declare into. The shell has already called ui::begin and opened the root.
  • list is a gfx_list for painting straight on top of what the tree draws.
  • input is this frame's ui::input.
  • dt and time are in seconds. width and height are in logical units, and scale is physical pixels per unit. See pixels and high DPI.
  • zoom is the page magnification this frame is drawn at, 1 when not zoomed. See pinch zoom.
  • fullscreen and maximized give the window state, and window_changed is true on the frame either one changed. See window chrome.
  • backend and native are for level two.

Internally, isolen_run is exactly level one: open, loop over isolen_next_frame calling the view, then close.

Last updated 6 October 2026