Docs: tighter, and current with master

Same facts in fewer words across README, CLAUDE.md, CONTRIBUTING,
DOCUMENTATION, FAQ, DEMO and NOTICE, and the claims that had drifted from
the code brought back in line:

- CI runs eleven console tests from tools/ci/tests.txt, plus the scripted
  uitest, skiptest and damagetest; the Tests table lists the last two.
- Linux ARMv7 and RISC-V build on every pull request, emulated and allowed
  to fail, not only on master.
- CONTRIBUTING runs the tests from tools/ci/tests.txt instead of an old list.
- The showcase is about 4,600 lines and notepad about 410.
- The shared library also ships as -macos-universal.
- SDL's GPU API is built only with REAKTOR_SHADERS.
- The architecture list names core/sdl and damage drawing.
- CLAUDE.md: --shot also hides partial redraws; damagetest catches them.
- PLAN.md is marked finished, with what has changed since.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Roman Chojnacki
2026-11-09 16:32:35 +01:00
co-authored by Claude Opus 5.5
parent 5bf6513957
commit be028beec5
8 changed files with 718 additions and 705 deletions
+20 -19
View File
@@ -4,15 +4,15 @@ C99. Widgets are declared; the look comes from CSS read at runtime.
## Build and run
`./build.sh [target]` (`./build.ps1` on Windows; `cmake` is not on PATH, the
script finds it). Targets: `showcase`, `notepad`, `simple`, `bench`, the tests
`./build.sh [target]` (`./build.ps1` on Windows, which finds `cmake`; it is
not on PATH). Targets: `showcase`, `notepad`, `simple`, `bench`, the tests
in `tests/`, and `libreaktor`. `-Arch x86|arm64` builds into `build-<arch>`;
ARM64 is checked only by CI.
CMake options pass through: `./build.ps1 -DREAKTOR_A11Y=OFF`,
`./build.sh -- -DREAKTOR_A11Y=OFF`. The cache keeps them, so pass `=OFF` or
`=ON` again to switch back. Check `build/CMakeCache.txt` before measuring:
`REAKTOR_SHARED=ON` left in `build/` makes every sample a shared one.
`./build.sh -- -DREAKTOR_A11Y=OFF`. The cache keeps them; pass `=ON` to switch
back. Check `build/CMakeCache.txt` before measuring: `REAKTOR_SHARED=ON` left
in `build/` links every sample shared.
Shipping: `tools/package.sh` packs a release folder, `tools/libreaktor-pkg.sh`
a system package (`libreaktor` static; with `-s`, `libreaktor1`,
@@ -21,16 +21,16 @@ publishes through `release.yml`.
## Verify against pixels, not source
Reasoning about what a dependency will draw has been wrong too often. Take the
screenshot and diff the dump:
Reasoning about what a dependency will draw has been wrong too often. Take
the screenshot and diff the dump:
```bash
./build/showcase --tab 7 --theme dark --shot a.bmp --a11y-dump a.txt
```
The dump has one line per node with role, name, value, state and bounds, so
a one-pixel move shows. Lines marked `volatile` (Diagnostics timings) differ
on every run.
The dump has a line per node with role, name, value, state and bounds, so a
one-pixel move shows. Lines marked `volatile` (Diagnostics timings) differ
every run.
## Traps that have cost real time
@@ -57,13 +57,14 @@ on every run.
renderer, so `reaktor_render` swaps each rounded fill for
`reaktor_fill_round`, relinking the command list (it ends where a `next`
reaches `ctx->memory.allocated`).
- **SDL draws when it flushes, not when it is asked.** Its calls only queue, so
without a GPU most of a frame is the flush the runtime makes before timing
the present; the Diagnostics page and `bench --no-vsync` split them. Vsync
sits in the present, so a total that matches the refresh rate measures it.
- **`--shot` never skips a frame.** It and a capture force the draw, so a pixel
diff cannot see what skipping an unchanged frame breaks; `tests/skiptest.c`
can. Skipping is the default; `.draw_every_frame` turns it off.
- **SDL draws when it flushes, not when it is asked.** Its calls only queue,
so without a GPU most of a frame is the flush the runtime makes before
timing the present; the Diagnostics page and `bench --no-vsync` split them.
Vsync sits in the present: a total matching the refresh rate measures it.
- **`--shot` never skips a frame.** It and a capture force a whole draw, so a
pixel diff cannot see what skipping an unchanged frame, or redrawing only
what changed, breaks; `tests/skiptest.c` and `tests/damagetest.c` can.
Skipping is the default; `.draw_every_frame` turns it off.
- **Text the atlas lacks is not Nuklear's.** Strings with Japanese, Arabic and
the like are measured and drawn by `core/text/text.c` through a custom
command. mojibake 0.5.0 records `byte_offset` at a character's last byte.
@@ -81,8 +82,8 @@ on every run.
stops it.
- **Web: SDL delivers events a frame late**, so the page's own typing goes
through SDL's queue to keep its order.
- **Web: a hidden page runs no frames.** No `requestAnimationFrame` in a
background tab, so the canvas and a11y tree stay empty. Check
- **Web: a hidden page runs no frames.** A background tab fires no
`requestAnimationFrame`, so the canvas and a11y tree stay empty. Check
`document.visibilityState`.
- **The shared library exports only `tools/reaktor.map`.** A new public call
goes in the map, or `check-exports.sh` fails; a struct an app sees that
+30 -30
View File
@@ -1,28 +1,28 @@
# Contributing
Pull requests are welcome, and so is an issue that just says "this looks
wrong" with a screenshot.
Pull requests are welcome, and so is an issue that says "this looks wrong"
with a screenshot.
## Getting started
```bash
git submodule update --init --recursive
./build.sh # build.ps1 on Windows
for t in laytest onlaytest a11ytest animtest keytest localetest texttest
do ./build/$t || break; done
for t in $(cat tools/ci/tests.txt); do ./build/$t || break; done
```
`./build-wasm.sh` builds the web target from the same sources and catches what
the native build lets through; run it before sending anything.
[docs/DOCUMENTATION.md](docs/DOCUMENTATION.md) is the map — read its
[Nuklear traps](docs/DOCUMENTATION.md#nuklear-traps) before touching drawing
code.
`tools/ci/tests.txt` lists the console tests CI runs; `sh tools/ci/uitest.sh
build` runs the scripted ones. `./build-wasm.sh` builds the web target from the
same sources and catches what the native build lets through; run it before
sending anything. [docs/DOCUMENTATION.md](docs/DOCUMENTATION.md) is the map:
read its [Nuklear traps](docs/DOCUMENTATION.md#nuklear-traps) before touching
drawing code.
## Conventions
- **C99, portable, no compiler extensions.** A platform subsystem goes in
`platform/`; a single platform fact goes behind `_WIN32`, `__APPLE__`,
`__linux__` or `__EMSCRIPTEN__` where it is needed.
`__linux__` or `__EMSCRIPTEN__` where needed.
- **Around 79 columns**, four-space indent, no tabs, American English.
- **Few comments.** One line, and only where removing it would invite a bug.
- **`reaktor_` prefixes anything crossing a translation unit**; everything
@@ -34,45 +34,45 @@ Binding unless you make the case for changing one.
- **Submodules are read, never edited, never quoted.** No value is copied out
of `external/`; the app opens the file at run time. The only vendored source
is `core/render/nk_sdl3_renderer.h`, with every deviation marked `REAKTOR`.
The only bytes compiled in are `REAKTOR_BUILTINS`.
is `core/render/nk_sdl3_renderer.h`, every deviation marked `REAKTOR`. The
only bytes compiled in are `REAKTOR_BUILTINS`.
- **The stylesheet is the source of style.** A color, radius, border or
padding written as a literal in C needs a reason beside it, such as a
fallback for a sheet that failed to load.
padding written as a C literal needs a reason beside it, such as a fallback
for a sheet that failed to load.
- **Permissive licenses only, MIT preferred.** Record a dependency in
[docs/NOTICE.md](docs/NOTICE.md) in the same change, from the project's own
license file. A vendored asset carries its terms in the tree;
`assets/fonts/Aileron-Notice.txt` is the shape to copy.
- **An optional feature is a module**: an interface library, a `_none` twin
defining the same functions, and a `REAKTOR_<NAME>` option, `ON` by default.
Switched off, a build draws the same pixels and writes the same
`--a11y-dump`, except for what the module itself produces.
Off, a build draws the same pixels and writes the same `--a11y-dump`, except
for what the module itself produces.
- **Nothing is drawn when nothing has changed.** No timers, polling or
unconditional repaints; mark what changed.
- **Every asset goes through `reaktor_asset_load()`**, which resolves a name
under the `.reaktor-root` marker, then the compiled-in copies, never the
working directory. No network fetches.
- **No environment variables.** Anything worth overriding is a command-line
flag the runtime strips from `argv`.
- **Every asset goes through `reaktor_asset_load()`**: a name under the
`.reaktor-root` marker, then the compiled-in copies, never the working
directory. No network fetches.
- **No environment variables.** An override is a command-line flag the
runtime strips from `argv`.
## Saying what you verified
In the pull request:
- that native and WebAssembly both build and the tests pass;
- that native and WebAssembly build and the tests pass;
- **the accessibility dump before and after**, if anything moved: run with
`--a11y-dump <path>` and diff the two;
- a screenshot for a visible change, pinned with `--tab`, `--scroll` and
- a screenshot of a visible change, pinned with `--tab`, `--scroll` and
`--theme` and written by `--shot`.
A visual fix is proven by the framebuffer, not by reasoning from the source
that drew it wrong. A performance claim needs a number from the Diagnostics
page or `bench --no-vsync`, and a claim against another framework needs
The framebuffer proves a visual fix, not reasoning from the source that drew
it wrong. A performance claim needs a number from the Diagnostics page or
`bench --no-vsync`, and a claim against another framework needs
`benchmarks/run.ps1`; several plausible optimizations here measured worse.
## Review
Automated review is a first pass. It finds a missing bounds check, but not that
a widget is drawn as it is because the alternative was tried and looked wrong.
For a change to layout, styling or frame pacing, say what you tried and what
it looked like.
Automated review is a first pass. It finds a missing bounds check, not that a
widget is drawn as it is because the alternative was tried and looked wrong.
For a change to layout, styling or frame pacing, say what you tried and how it
looked.
+9
View File
@@ -1,5 +1,14 @@
# Plan: libreaktor as a shared library
> **Finished.** Every phase below has shipped; this is the record of how, and
> it no longer describes the code. Since it was written the soname became
> `libreaktor.so.1` (runtime package `libreaktor1`, ABI tables
> `tools/abi/libreaktor.so.1-*.abi`), the packages became `libreaktor`
> (static) and `libreaktor-shared` (the split's development package), and
> the release archives `libreaktor-*` and `libreaktor-shared-*`. The current
> state is in [DOCUMENTATION.md](docs/DOCUMENTATION.md#in-your-own-project),
> the measurements in [PERFORMANCE.md](docs/PERFORMANCE.md).
**Decision (2026-11-02): go.** Three apps together save 14.8%, under the 20%
threshold, but four save 20.4% and five 24.2% (Phase 0d), and Reaktor apps
are expected to run four or more at a time. Phase 1 starts. Static stays the
+55 -57
View File
@@ -11,13 +11,13 @@ dozen dependencies just to put a dialog on screen? And of small alternatives
always lacking crucial features? No? But I was, so I wrote Reaktor: complete
without being big. A 2.1 MB binary, 7–13 MB of RAM, and no GPU required.
**[Try the showcase in your browser](https://alpaq92.github.io/Reaktor/)** — the
same program, built to WebAssembly — or
**[Try the showcase in your browser](https://alpaq92.github.io/Reaktor/)**, the
same program built to WebAssembly, or
**[download it](https://github.com/Alpaq92/Reaktor/releases/latest)** for
Windows, macOS, Linux, FreeBSD, OpenBSD or NetBSD, or as WebAssembly to serve
Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD, or as WebAssembly to serve
yourself.
> ⚠️ **Reaktor is in active development**, and breaking changes might occur.
> ⚠️ **Reaktor is in active development**; breaking changes may occur.
<p align="center">
<a href="docs/PERFORMANCE.md"><img src="docs/benchmark.svg" alt="Two bar charts of drawing 64 rotating boxes at 60 fps in an 800x600 window. Memory: Reaktor 8.9 MB, the same program on D3D12 120.5 MB and on OpenGL 69.2 MB, Flutter 132.7 MB, Electron 156.3 MB, Kotlin Multiplatform 668.7 MB. Steady-state CPU as a percent of one core: Reaktor 6.3%, D3D12 4.1%, OpenGL 5.5%, Flutter 15.3%, Electron 19.6%, Kotlin Multiplatform 29.4%"></a>
@@ -27,34 +27,33 @@ How, and on what, is in [PERFORMANCE.md](docs/PERFORMANCE.md).
## Features
- **24 declared widgets** — buttons, fields, checks, radios, sliders, knobs,
spinners, combos, a color picker, date and time pickers, sidebar, tabs, a
menu bar, tables, trees and a splitter, with tooltips; rows drag between
lists; all of Nuklear underneath, under Reaktor's names.
- **Layers** — menus in windows of their own, in-window dialogs, modal
questions, toasts, more native windows, and a tray icon with its own menu.
- **Services** — system open, save and folder pickers, timers, main-thread
posting, settings that persist, an undo stack, system notifications, and
printing and PDF export.
- **24 declared widgets**: buttons, fields, checks, radios, sliders, knobs,
spinners, combos, color, date and time pickers, sidebar, tabs, a menu bar,
tables, trees and a splitter, with tooltips and rows that drag between
lists. All of Nuklear is underneath, under Reaktor's names.
- **Layers**: menus in windows of their own, in-window dialogs, modal
questions, toasts, more native windows, and a tray icon with a menu.
- **Services**: system open, save and folder pickers, timers, main-thread
posting, persistent settings, undo, system notifications, printing and PDF
export.
- **Styled by CSS** read at run time: color, type, borders, radii, spacing,
`:hover` and `:active`, light and dark. Swap the sheet and the app changes.
- **Accessible with no code** — UI Automation, NSAccessibility, AT-SPI and a
DOM subtree on the web, with keyboard navigation throughout.
- **Localization** — catalogs, plural rules, and numbers, money and dates as
- **Accessible with no code**: UI Automation, NSAccessibility, AT-SPI and a
DOM subtree on the web, and keyboard navigation throughout.
- **Localization**: catalogs, plural rules, and numbers, money and dates as
each language writes them.
- **Text past Latin-1** — direction, shaping, fallback fonts and Unicode line
- **Text past Latin-1**: direction, shaping, fallback fonts and Unicode line
breaking, so Japanese wraps properly.
- **Animation** — tweens keyed per widget on 31 curves, springs, steps and
- **Animation**: tweens keyed per widget on 31 curves, springs, steps and
béziers; keyframed clips staggered across a grid; motion paths,
oscillators, noise and shakes; colors blended in five spaces; and text
that arrives a glyph at a time, idle once everything settles.
- **Modular** — accessibility, localization, text shaping, settings, the tray,
oscillators, noise and shakes; colors blended in five spaces; text that
arrives a glyph at a time. Idle once everything settles.
- **Modular**: accessibility, localization, text shaping, settings, the tray,
popup windows, notifications, printing and the Inspector each swap for a
stub at build time, and only what they drew stops being drawn; every other
pixel stays.
- **Windows, macOS, Linux, the BSDs and WebAssembly** from one set of sources,
on one software rasterizer, at any display scale: x86 and ARM everywhere,
and RISC-V on Linux ([Platforms](docs/DOCUMENTATION.md#platforms)).
stub at build time. Only what they drew goes; every other pixel stays.
- **Windows, macOS, Linux, the BSDs and WebAssembly** from one set of sources
and one software rasterizer, at any display scale: x86 and ARM everywhere,
RISC-V on Linux ([Platforms](docs/DOCUMENTATION.md#platforms)).
- **Nothing drawn at rest** — 0% of a core while it sits there.
## Build
@@ -70,31 +69,30 @@ cd Reaktor
```
`./build-wasm.sh` (`build-wasm.ps1` on Windows, with
[emsdk](https://emscripten.org)) builds the web versions into `build-wasm/`, to
be served over HTTP.
[emsdk](https://emscripten.org)) builds the web versions into `build-wasm/`,
to be served over HTTP.
To build your own application, add Reaktor with `add_subdirectory` and declare
it with `reaktor_add_app`, or take a `libreaktor` package from the
For your own application, `add_subdirectory` Reaktor and declare the app with
`reaktor_add_app`, or take a `libreaktor` package from the
[releases](https://github.com/Alpaq92/Reaktor/releases/latest) and
`find_package(reaktor)`: [In your own project](docs/DOCUMENTATION.md#in-your-own-project).
## Install
On Linux and the BSDs, one script builds libreaktor as the system's own
package (`.deb`, `.rpm`, FreeBSD, OpenBSD or NetBSD) and installs it:
On Linux and the BSDs, one script builds libreaktor as a system package
(`.deb`, `.rpm`, FreeBSD, OpenBSD or NetBSD) and installs it:
```bash
sh tools/libreaktor-pkg.sh -i
```
It lands in `/opt/reaktor` (`/usr/local/reaktor` on the BSDs); build against it
with `-DCMAKE_PREFIX_PATH=/opt/reaktor`, or `pkg-config` with
`PKG_CONFIG_PATH=/opt/reaktor/lib/pkgconfig`. Remove it with the system's
package manager: it is `libreaktor` everywhere. With `-s` it also
builds `libreaktor.so` and packs three packages instead: `libreaktor-sdl3-0`
and `libreaktor1`, which an app needs to run, and `libreaktor-shared` to
build one. `libreaktor` and `libreaktor-shared` conflict; install one or the
other.
It lands in `/opt/reaktor` (`/usr/local/reaktor` on the BSDs); build against
it with `-DCMAKE_PREFIX_PATH=/opt/reaktor`, or `pkg-config` with
`PKG_CONFIG_PATH=/opt/reaktor/lib/pkgconfig`. The package manager removes it:
it is `libreaktor` everywhere. `-s` also builds `libreaktor.so` and packs
three packages instead: `libreaktor-sdl3-0` and `libreaktor1` to run an app,
`libreaktor-shared` to build one. `libreaktor` and `libreaktor-shared`
conflict; install one.
## Usage
@@ -113,35 +111,35 @@ REAKTOR_COLUMN(.gap = 10) {
}
```
No colors, radii, padding or font sizes: they come from a stylesheet read at
startup. Nothing for screen readers either: each widget reports its own name,
value and position.
No colors, radii, padding or font sizes: a stylesheet read at startup gives
them. Nothing for screen readers either: each widget reports its name, value
and position.
## Made of
[Nuklear](https://github.com/Immediate-Mode-UI/Nuklear) draws the widgets.
[SDL3](https://github.com/libsdl-org/SDL) supplies the window, input and
[SDL3](https://github.com/libsdl-org/SDL) supplies the window, input,
software renderer, and the tray on Windows and macOS; on Linux and the BSDs
the tray is Reaktor's, over the D-Bus client
[gibus](https://github.com/Alpaq92/gibus). Reaktor's own CSS engine
reads the stylesheets, and
[Onlay](https://github.com/Alpaq92/Onlay), a fork of
[randrew/layout](https://github.com/randrew/layout), computes the rectangles.
[NukAnim](https://github.com/Alpaq92/NukAnim), a port of ImAnim, moves them.
[gibus](https://github.com/Alpaq92/gibus). Reaktor's own CSS engine reads the
stylesheets. [Onlay](https://github.com/Alpaq92/Onlay), a fork of
[randrew/layout](https://github.com/randrew/layout), computes the rectangles,
and [NukAnim](https://github.com/Alpaq92/NukAnim), a port of ImAnim, moves
them.
Every dependency is a submodule, used as it ships; the full list is in
[NOTICE.md](docs/NOTICE.md).
## Documentation
- [DOCUMENTATION.md](docs/DOCUMENTATION.md) — the whole of it: every widget,
layout and layer, styling, then how it works inside.
- [FAQ.md](docs/FAQ.md) — short answers to common questions.
- [DEMO.md](docs/DEMO.md) — the four programs in this repository.
- [PERFORMANCE.md](docs/PERFORMANCE.md) — what it costs, measured.
- [BENCHMARKS.md](benchmarks/BENCHMARKS.md) — the comparison, as runnable
- [DOCUMENTATION.md](docs/DOCUMENTATION.md): every widget, layout, layer and
style, then how it works inside.
- [FAQ.md](docs/FAQ.md): short answers to common questions.
- [DEMO.md](docs/DEMO.md): the four programs in this repository.
- [PERFORMANCE.md](docs/PERFORMANCE.md): what it costs, measured.
- [BENCHMARKS.md](benchmarks/BENCHMARKS.md): the comparison, as runnable
projects.
- [NOTICE.md](docs/NOTICE.md) — dependencies and licenses.
- [NOTICE.md](docs/NOTICE.md): dependencies and licenses.
## License
MIT. The dependencies keep their own — see [NOTICE.md](docs/NOTICE.md).
MIT. The dependencies keep their own; see [NOTICE.md](docs/NOTICE.md).
+28 -28
View File
@@ -1,15 +1,15 @@
# The four programs
All four share `runtime/` and `core/`; what differs is `samples/`, and which
modules each links. The showcase takes every module. Notepad takes settings, popup
menus and printing; bench and simple take none, so they show what the runtime costs by
itself. Without the accessibility module, a screen reader finds nothing in
notepad, bench or simple.
All four share `runtime/` and `core/`; they differ in `samples/` and in the
modules they link. The showcase takes every module, notepad settings, popup
menus and printing; bench and simple take none, so they show what the runtime
costs alone. Without the accessibility module, a screen reader finds nothing
in notepad, bench or simple.
| | Lines | For |
| --- | --- | --- |
| `showcase` | ~3,300 | Every widget and layer, both schemes, three languages, and how far the CSS reaches |
| `notepad` | ~330 | A text editor that opens, edits, searches and saves a file of any size |
| `showcase` | ~4,600 | Every widget and layer, both schemes, three languages, and how far the CSS reaches |
| `notepad` | ~410 | A text editor that opens, edits, searches and saves a file of any size |
| `bench` | ~150 | The workload the published figures measure, here and in four other frameworks |
| `simple` | ~40 | One button that closes the window |
@@ -23,28 +23,28 @@ notepad, bench or simple.
## Showcase
It opens with a two-second splash: the mark, the name, Reaktor's and SDL's
versions and what it is built on, each fading in after the one before. The
web build shows its loading screen instead.
versions and what it is built on, fading in one after another. The web build
shows its loading screen instead.
<p align="center">
<img src="../assets/screenshots/showcase.png" alt="The Reaktor showcase under the system's titlebar in the dark scheme: the sidebar of pages with System chosen at its foot, and the Login page's card in a rounded panel">
</p>
Ten pages in a sidebar — Login, Buttons, Inputs, Display, Layout, Popups,
Animation, Styling, Translations, Diagnostics — with the color scheme and the
Ten pages in a sidebar (Login, Buttons, Inputs, Display, Layout, Popups,
Animation, Styling, Translations, Diagnostics), the color scheme and the
titlebar switch at its foot, and an icon in the tray. It is the reference for
what the library draws, and where its claims are tested rather than asserted:
what the library draws, where its claims are tested rather than asserted:
- **Styling** lays Simple.css over Water.css at the flick of a checkbox, and
prints what each rule resolved to beside the widgets it painted.
- **Styling** lays Simple.css over Water.css with a checkbox, and prints what
each rule resolved to beside the widgets it painted.
- **Translations** sets the opening of *The Ugly Duckling* in English, Polish
and Japanese from the catalogs, beside a date, a number, one amount in three
currencies and a count of ducklings, each written the way that language
writes it. The Japanese is drawn by the Text module.
- **Popups** opens floaters, toasts, windows of their own, menus and the tray,
and can have the showcase ask before it closes.
- **Diagnostics** shows the renderer, and where each frame's milliseconds and
each megabyte went, live.
- **Diagnostics** shows the renderer, and live, where each frame's
milliseconds and each megabyte went.
- **Animation** sends five blocks to one stop, one of them instantly, draws
all 31 easing curves through the function the widgets animate with, and
plays the rest of NukAnim: a clip staggered across a grid under its debug
@@ -58,10 +58,10 @@ what the library draws, and where its claims are tested rather than asserted:
</p>
A real editor in one file: a menu bar, a multiline field with line numbers
that grows to fit any file, a find bar, printing and PDF export, a status line, the platform's own open
and save dialogs, and eight shortcuts. A page of widgets
never has to answer what happens to a modified document, or where a menu's last
item lands when its popup is a pixel short; this does.
that grows to fit any file, a find bar, printing and PDF export, a status
line, the platform's open and save dialogs, and eight shortcuts. A page of
widgets never has to answer what happens to a modified document, or where a
menu's last item lands when its popup is a pixel short; this does.
## Bench
@@ -70,8 +70,8 @@ item lands when its popup is a pixel short; this does.
</p>
Sixty-four rotating boxes, at the display's rate or flat out with
`--no-vsync`, for `--bench-seconds`, then what the run cost on stdout. Six
seconds flat out, on the Windows machine that
`--no-vsync`, for `--bench-seconds`, then what the run cost, on stdout. Six
seconds flat out on the Windows machine
[PERFORMANCE.md](PERFORMANCE.md#where-the-numbers-came-from) names:
```
@@ -88,11 +88,11 @@ private_mb 6.0
```
With `--no-vsync`, read `cpu_at_60fps`, not `cpu_percent`. On vsync,
`SDL_RenderPresent` waits for the next vblank, and whether that wait is charged
depends on whether SDL blocks or spins: the same 386 frames have read anywhere
from 0.3% to 99.6% of a core. `size` is the drawing area, printed because four
`SDL_RenderPresent` waits for the next vblank, and whether the wait is charged
depends on whether SDL blocks or spins: the same 386 frames have read from
0.3% to 99.6% of a core. `size` is the drawing area, printed because four
other frameworks in `benchmarks/` draw the same picture. `--boxes` changes the
workload, and `--fps` holds it to a rate.
workload; `--fps` holds it to a rate.
It is deliberately what the library is worst at. Everything else in
PERFORMANCE.md counts frames, because nothing is drawn while nothing changes;
@@ -106,7 +106,7 @@ bars in the chart there come from this program, one per renderer.
</p>
One centered button that closes the window, in about forty lines: the
smallest thing that is still an application, and the one to start from.
smallest application, and the one to start from.
## Running one the same way twice
@@ -116,5 +116,5 @@ smallest thing that is still an application, and the one to start from.
`--shot` writes the window once it settles and quits; `--a11y-dump` writes
every node's role, name, value, state and rectangle. Diff two dumps and
anything that moved by a pixel says so. The rest of the flags are in
anything that moved by a pixel shows. The other flags are in
[DOCUMENTATION.md](DOCUMENTATION.md#command-line-flags).
+466 -457
View File
File diff suppressed because it is too large Load Diff
+60 -65
View File
@@ -53,48 +53,45 @@
### What is Reaktor, and how is it different from Nuklear?
Reaktor is a toolkit for building desktop and web apps in C. Nuklear, which it
is built on, gives you widgets and leaves everything else to
you. Reaktor fills in the rest:
A toolkit for desktop and web apps in C. Nuklear, which it is built on, gives
you widgets and leaves the rest to you. Reaktor fills it in:
- **The whole stack, ready to use.** Nuklear only draws; the window, input,
fonts and rendering are yours to wire up. Reaktor brings them, built on
SDL, so there is nothing to connect yourself.
- **The whole stack.** Nuklear only draws; the window, input, fonts and
rendering are yours to wire up. Reaktor brings them, on SDL.
- **A finished app, not a drawing kit.** One call opens a window and runs
it; you describe what's on screen and Reaktor lays it out.
it; you describe what is on screen and Reaktor lays it out.
- **A look you change without recompiling.** Colors, fonts, spacing and
rounded corners come from ordinary CSS files, with light and dark themes.
- **Everyone can use it.** Screen readers can read it, and every control
works from the keyboard.
rounded corners come from ordinary CSS files, light and dark.
- **Everyone can use it.** Screen readers read it, and every control works
from the keyboard.
- **Any language.** Translations, number and date formats, and scripts such
as Japanese and Arabic.
- **What real apps need.** Menus, file pickers, dialogs, notifications,
undo, printing, saved settings, extra windows and a tray icon.
- **One codebase everywhere.** Windows, macOS, Linux, the BSDs and the
browser.
- **One codebase.** Windows, macOS, Linux, the BSDs and the browser.
Nuklear is still there underneath when you need something it offers
directly. See [An application](DOCUMENTATION.md#an-application).
Nuklear is still underneath when you need it directly. See
[An application](DOCUMENTATION.md#an-application).
### Why C99 and an immediate-mode core instead of a retained toolkit like GTK or Qt?
To stay small: a 2.1 MB binary, 7–13 MB of RAM, no GPU, and nothing to
install beside it. A frame is drawn only when something changes, so the app
idles at 0% of a core. See [The frame loop](DOCUMENTATION.md#the-frame-loop)
To stay small: a 2.1 MB binary, 7–13 MB of RAM, no GPU, nothing to install
beside it. A frame is drawn only when something changes, so the app idles at
0% of a core. See [The frame loop](DOCUMENTATION.md#the-frame-loop)
and [PERFORMANCE.md](PERFORMANCE.md).
### Which platforms and architectures are supported?
Windows, macOS, Linux, FreeBSD, OpenBSD, NetBSD and WebAssembly, on x86 and
ARM, plus ARMv7 and RISC-V on Linux. Every pull request builds them all; the
BSDs' ARM64 runs under emulation and may fail without failing the run. See
ARM, plus ARMv7 and RISC-V on Linux. Every pull request builds them all; a
job that runs under emulation (the BSDs' ARM64, Linux's ARMv7 and RISC-V) may
fail without failing the run. See
[Platforms](DOCUMENTATION.md#platforms).
### What license is it under?
MIT. Each dependency keeps its own license, all permissive; a release ships
them in `licenses/` with [NOTICE.md](NOTICE.md), and your app should carry
them too.
MIT. Each dependency keeps its own permissive license; a release ships them in
`licenses/` with [NOTICE.md](NOTICE.md), and your app should carry them too.
---
@@ -109,10 +106,10 @@ axis. Leave the axis unset and the rule applies. See
### Why can't I use `em` or `rem`, and how far do `var()` and `color-mix()` go?
You can: `em` is the body's font size and `rem` the root's. The engine also
resolves `var()`, works out `color-mix(in srgb, …)` and `calc()` over pixels,
and keeps the `prefers-color-scheme` branch for the active scheme. Percentages
are not lengths, and operator selectors such as `[href^="http"]` are dropped.
See [Styling](DOCUMENTATION.md#styling).
resolves `var()`, `color-mix(in srgb, …)` and `calc()` over pixels, and keeps
the `prefers-color-scheme` branch for the active scheme. Percentages are not
lengths, and operator selectors such as `[href^="http"]` are dropped. See
[Styling](DOCUMENTATION.md#styling).
### How do I ship my own stylesheet or theme?
@@ -128,9 +125,9 @@ and `--css` adds one on top. `.no_reaktor_css` drops reaktor.css. See
### Why does a widget have no rectangle, or the declared tree not settle?
A box is placed one frame late and found again by its name. A widget whose
label changes every frame needs a stable `.name`, and a node declared only on
some frames renumbers everything after it. A loose label after a row belongs
inside a named `REAKTOR_COLUMN`. See [Layout](DOCUMENTATION.md#layout).
label changes every frame needs a stable `.name`; a node declared only on some
frames renumbers everything after it. A loose label after a row belongs inside
a named `REAKTOR_COLUMN`. See [Layout](DOCUMENTATION.md#layout).
### Can I still call Nuklear directly?
@@ -141,9 +138,9 @@ a panel, but a group or popup is its own panel. See
### How do I write a widget of my own?
Lay it out by hand in a group, from the pieces in `ui.h`: colors from the
Lay it out by hand in a group from the pieces in `ui.h`: colors from the
sheet, rounded fills and borders, a hot rectangle so hover redraws, and a
`reaktor_note` so screen readers and keyboard focus see it. See
`reaktor_note` so screen readers and keyboard focus find it. See
[Beyond the specs](DOCUMENTATION.md#beyond-the-specs).
---
@@ -152,10 +149,10 @@ sheet, rounded fills and borders, a hot rectangle so hover redraws, and a
### Where are settings stored, and when are they saved?
In `settings.toml`, a TOML file in SDL's preference folder for the app.
`.save_settings` picks when: never (the default), on quit, on every change,
or `.save_ms` after a change. `reaktor_settings_save` writes now and
`reaktor_settings_clear` empties them and deletes the file. See
In `settings.toml`, in SDL's preference folder for the app. `.save_settings`
picks when: never (the default), on quit, on every change, or `.save_ms`
after a change. `reaktor_settings_save` writes now; `reaktor_settings_clear`
empties them and deletes the file. See
[Services](DOCUMENTATION.md#services).
### How do settings work on the web?
@@ -180,8 +177,8 @@ followed by a frame. See [Services](DOCUMENTATION.md#services).
### How do I add undo, notifications or printing?
Push a step with an undo and a redo callback after each change, and Ctrl+Z
and Ctrl+Y take it back and forth, merging typing into one step if asked.
Push a step with undo and redo callbacks after each change; Ctrl+Z and Ctrl+Y
take it back and forth, merging typing into one step if asked.
`reaktor_notify` shows a message outside the window. `reaktor_print` and
`reaktor_print_pdf` lay pages out as the window does and print them or write
a PDF. See [Services](DOCUMENTATION.md#services).
@@ -192,7 +189,7 @@ a PDF. See [Services](DOCUMENTATION.md#services).
### How do I build without CMake on PATH, or for x86 or ARM64?
`./build.ps1` on Windows finds MSVC's CMake; `./build.sh` elsewhere.
`./build.ps1` on Windows finds Visual Studio's CMake; `./build.sh` elsewhere.
`./build.ps1 -Arch x86` or `-Arch arm64` builds that architecture into
`build-<arch>`; ARM64 needs Visual Studio's ARM64 tools. See
[Platforms](DOCUMENTATION.md#platforms).
@@ -200,28 +197,28 @@ a PDF. See [Services](DOCUMENTATION.md#services).
### How do I turn off accessibility, localization or text shaping?
`-DREAKTOR_A11Y=OFF`, `-DREAKTOR_LOCALE=OFF` or `-DREAKTOR_TEXT=OFF`. Each
swaps in a stub, and pixels and `--a11y-dump` stay identical apart from what
the module drew. CMake keeps the option until you pass `=ON`. See
swaps in a stub; pixels and `--a11y-dump` stay identical apart from what the
module drew. CMake keeps the option until you pass `=ON`. See
[Build options](DOCUMENTATION.md#build-options).
### How do I install libreaktor and link against it?
Take the release's archive or the `.deb` or `.rpm`, or run
Take the release's archive, `.deb` or `.rpm`, or run
`sh tools/libreaktor-pkg.sh -i`. Then `find_package(reaktor 0.10 REQUIRED)`
and link `reaktor::reaktor`, or use `pkg-config --cflags --libs reaktor`. To
build it into your tree instead, `add_subdirectory` the checkout and call
build it into your tree, `add_subdirectory` the checkout and call
`reaktor_add_app`. See [In your own project](DOCUMENTATION.md#in-your-own-project).
### How do I build and host the WebAssembly version?
`./build-wasm.sh` (or `.ps1`) with emsdk writes the pages into `build-wasm/`;
serve that folder over HTTP, since opening the file directly will not load.
`./build-wasm.sh` (or `.ps1`) with emsdk writes the pages into `build-wasm/`.
Serve that folder over HTTP; opened as a file, a page will not load.
See [The web build](DOCUMENTATION.md#the-web-build).
### Why is the web page blank in a background tab?
The loop waits on `requestAnimationFrame`, which a hidden tab, a minimized
window or an off-screen pane never fires. It draws once it is visible.
window or an off-screen pane never fires. It draws once visible.
---
@@ -233,39 +230,37 @@ window or an off-screen pane never fires. It draws once it is visible.
./build/showcase --tab 7 --theme dark --shot a.bmp --a11y-dump a.txt
```
Any app takes `--shot` and `--a11y-dump`; the dump lists every node with its
bounds, so two dumps diff to the pixel. Settings are not read under either.
Any app takes `--shot` and `--a11y-dump`. The dump lists every node with its
bounds, so two dumps diff to the pixel. Neither reads settings.
See [Command-line flags](DOCUMENTATION.md#command-line-flags).
### Should my app use a GPU renderer?
Usually not. `software`, the default, needs no GPU, uses about a tenth of the
memory and starts fastest. A GPU
renderer pays off in long, continuous animation: `--renderer gpu` takes
Metal on macOS; on Windows OpenGL where the build has it, else Direct3D 12,
else 11, so `directx` on a default build; on Linux and the BSDs OpenGL, else
OpenGL ES 2, neither built unless `REAKTOR_RENDERERS` names it. Expect six
to thirteen times the memory. See
memory and starts fastest. A GPU renderer pays off in long, continuous
animation. `--renderer gpu` takes Metal on macOS; on Windows OpenGL where the
build has it, else Direct3D 12, else 11, so `directx` on a default build; on
Linux and the BSDs OpenGL, else OpenGL ES 2, neither built unless
`REAKTOR_RENDERERS` names it. Expect six to thirteen times the memory. See
[The renderer](DOCUMENTATION.md#the-renderer).
### Why is the frame time high on a machine with no GPU?
Most of it is usually rasterizing: SDL queues what it is asked to draw and fills the
pixels when that queue is flushed. The rest is mostly copying the frame to the
window. The Diagnostics page and `bench --no-vsync` split build, render and
present. See [The renderer](DOCUMENTATION.md#the-renderer).
Most of it is usually rasterizing: SDL queues what it is asked to draw and
fills the pixels when the queue is flushed. Most of the rest is copying the
frame to the window. The Diagnostics page and `bench --no-vsync` split build,
render and present. See [The renderer](DOCUMENTATION.md#the-renderer).
### Why does Japanese or Arabic text draw differently from Latin?
A string with a character the font atlas lacks is drawn by the Text module,
which orders, shapes and takes glyphs from fallback fonts; the rest is
Nuklear's. Arabic, Hebrew or an Indic script needs a font that has it, passed
with `--font-fallback` or `.font_fallbacks`. See [Text](DOCUMENTATION.md#text).
The Text module draws a string with a character the atlas lacks: it orders,
shapes and takes glyphs from fallback fonts. The rest is Nuklear's. Arabic,
Hebrew or an Indic script needs a font that has it, passed with
`--font-fallback` or `.font_fallbacks`. See [Text](DOCUMENTATION.md#text).
### How do I report a bug?
Open an issue at [github.com/Alpaq92/Reaktor/issues](https://github.com/Alpaq92/Reaktor/issues)
with the Reaktor version (`reaktor_version()`), the system and architecture,
the steps that show it, and what you expected. For anything drawn wrong,
attach a `--shot` and an `--a11y-dump` of it; for a crash, what the
`--console debug` log printed.
with the Reaktor version (`reaktor_version()`), system and architecture, the
steps that show it, and what you expected. For anything drawn wrong, attach a
`--shot` and an `--a11y-dump`; for a crash, what `--console debug` printed.
+50 -49
View File
@@ -2,8 +2,8 @@
Reaktor is MIT ([LICENSE](../LICENSE)). Everything it is built on is a git
submodule under `external/`, used as it ships; each license below was read
from the project's own license file at the pinned revision.
`git submodule status` prints the pins.
from the project's own license file at the pinned revision, which
`git submodule status` prints.
| Component | Used for | License |
| --- | --- | --- |
@@ -22,25 +22,25 @@ from the project's own license file at the pinned revision.
| [toml-c](https://github.com/arp242/toml-c) | Reading `settings.toml`; a fork of [tomlc99](https://github.com/cktan/tomlc99), whose copyright notice it keeps | MIT |
| [gibus](https://github.com/Alpaq92/gibus) | D-Bus on Linux and the BSDs, for the AT-SPI bridge, the tray, notifications and the desktop portal's settings — a port of [minidbus](https://codefloe.com/Honken/minidbus), whose copyright notice it keeps | MIT |
SDL is built static — and, in a `REAKTOR_SHARED` build on Linux and the BSDs,
shared too, as `libreaktor-sdl3.so` — without audio, joystick, haptic, HID,
sensor, camera, power, GPU, offscreen, the render backends Reaktor never
selects, or its dynamic API (see below). Its tray is built, and opened on
Windows and macOS; on Linux and the BSDs Reaktor's own tray speaks
StatusNotifierItem and dbusmenu over gibus, so SDL's, which would load
AppIndicator and GTK 3, never opens there and nothing links them. mojibake is
built without its collation, IDNA, security
and character-name tables. NukAnim is one header, compiled in
SDL is built static (and, in a `REAKTOR_SHARED` build on Linux and the BSDs,
shared too, as `libreaktor-sdl3.so`) without audio, joystick, haptic, HID,
sensor, camera, power, offscreen, the render backends Reaktor never selects,
or its dynamic API (see below); its GPU API is built only with
`REAKTOR_SHADERS`. Its tray is built, and opened on Windows and macOS. On
Linux and the BSDs Reaktor's own tray speaks StatusNotifierItem and dbusmenu
over gibus, so SDL's, which would load AppIndicator and GTK 3, never opens
there and nothing links them. mojibake is built without its collation, IDNA,
security and character-name tables. NukAnim is one header, compiled in
`core/anim/anim.c`; its own Nuklear submodule, which only its tests use, comes
with a recursive checkout and is not built. kb_text_shape is one header, compiled in
`core/text/kb.c`; it shapes, and FreeType draws. FreeType is built with only
its TrueType, CFF, auto-hinter and anti-aliasing modules, and
with a recursive checkout and is not built. kb_text_shape is one header,
compiled in `core/text/kb.c`; it shapes, and FreeType draws. FreeType is built
with only its TrueType, CFF, auto-hinter and anti-aliasing modules, and
`core/render/ft/reaktor_ftoption.h` turns off what Reaktor never reads, its
environment override among them.
Nothing links libdbus. SDL still opens `libdbus-1.so.3` where the system has it,
for input methods, portals and the screensaver, and goes without it where it
does not.
Nothing links libdbus. SDL still opens `libdbus-1.so.3` where the system has
it, for input methods, portals and the screensaver, and does without it
elsewhere.
The stylesheets are read by Reaktor's own engine, `core/css/css.c`; no CSS
library is linked or copied.
@@ -51,26 +51,26 @@ Portions of this software are copyright © 2026 The FreeType Project
## The one vendored source file
`core/render/nk_sdl3_renderer.h` is Nuklear's SDL3 backend, copied from
`external/nuklear/demo/sdl3_renderer/` under Nuklear's license. Every deviation
is marked `REAKTOR`: an 8-bit indexed atlas, a 1×1 white texture for
untextured geometry, pixel snapping, fills and strokes feathered apart, the
atlas palette shared with the Text module, rectangles drawn from device pixels
by `nk_sdl_quad` on the software renderer, an upload for the atlas Reaktor
bakes itself, `tex_null` repointed after every bake, a key-up dropped for a key Nuklear does not hold, text input of any
length fed one rune at a time, and textures clamped rather than tested for
wrapping.
`external/nuklear/demo/sdl3_renderer/` under Nuklear's license. Every
deviation is marked `REAKTOR`: an 8-bit indexed atlas, a 1×1 white texture
for untextured geometry, pixel snapping, fills and strokes feathered apart,
the atlas palette shared with the Text module, rectangles drawn from device
pixels by `nk_sdl_quad` on the software renderer, an upload for the atlas
Reaktor bakes itself, `tex_null` repointed after every bake, a key-up dropped
for a key Nuklear does not hold, text input of any length fed one rune at a
time, and textures clamped rather than tested for wrapping.
It cannot stay an include because the changes sit inside its functions, and
submodules are not edited. The cost: when
Nuklear's backend changes, it is re-vendored and the hunks re-applied.
It cannot stay an include: the changes sit inside its functions, and
submodules are not edited. So when Nuklear's backend changes, it is
re-vendored and the hunks re-applied.
## The one change to how a submodule builds
SDL's dynamic API keeps every SDL function in the program and, at startup,
loads whichever SDL library the `SDL3_DYNAMIC_API` environment variable names.
It exists so a statically linked game can take a newer SDL; Reaktor's
programs are rebuilt against one instead, and read no environment. Without it
`simple` is 20% smaller and `showcase` 12%.
loads whichever SDL library the `SDL3_DYNAMIC_API` environment variable names,
so a statically linked game can take a newer SDL. Reaktor's programs are
rebuilt against one instead, and read no environment. Without it `simple` is
20% smaller and `showcase` 12%.
SDL refuses a command-line switch for it, so `core/sdl/no_dynapi.h` is forced
into SDL's sources and defines `SDL_dynapi_h_`, the guard of SDL's own
@@ -88,11 +88,11 @@ UI face, Karla, came from inside Nuklear with no license near it.
| **M PLUS 1p** | Japanese, for what Aileron lacks | OFL 1.1 | `assets/fonts/MPLUS1p-Notice.txt` |
Aileron is by Sora Sagano of DOT COLON. Its download has no license file, so
the terms were traced: the font's own `name` table says `copyright: No Rights
the terms were traced: the font's `name` table says `copyright: No Rights
Reserved.`, and dotcolon.net/font/aileron links CC0 beside it.
`Aileron-Notice.txt` records both, says this project assembled it, and
reproduces the CC0 legal code. It is an OTF with CFF outlines, which
FreeType reads.
reproduces the CC0 legal code. It is an OTF with CFF outlines, which FreeType
reads.
M PLUS 1p is by The M+ Project Authors. `MPLUS1p-Regular.ttf` is the file as
Google Fonts ships it; `MPLUS1p-Notice.txt` names its commit and SHA-256 and
@@ -114,7 +114,7 @@ translator who died before 1956:
All three are public domain in the United States, in Japan, and wherever
protection ends seventy years after the translator's death. Mexico's hundred
years and Colombia's eighty still cover the Japanese one, and no Japanese
years and Colombia's eighty still cover the Japanese one; no Japanese
translation with checkable dates clears them. Each catalog repeats its
attribution, and the page prints it under the story.
@@ -126,28 +126,29 @@ domain as a U.S. Government work.
## Benchmarks
Nothing in `benchmarks/` is listed above. Its four projects — Flutter,
Electron, Compose Multiplatform and Shaft — hold source and build files only;
Nothing in `benchmarks/` is listed above. Its four projects (Flutter,
Electron, Compose Multiplatform and Shaft) hold source and build files only;
each toolchain fetches its own framework, and none is part of a Reaktor build.
## What is redistributed
A native build links SDL, plutosvg, plutovg and FreeType
statically, plus mojibake and kb_text_shape with the Text module, and compiles
in Nuklear, NukAnim, Onlay and toml-c, and gibus on Linux and the BSDs, so it
carries the zlib, MIT and FreeType License terms above. Each license
is copied unchanged into `licenses/` beside the programs: ship that folder,
and this file, with a binary.
A native build links SDL, plutosvg, plutovg and FreeType statically, plus
mojibake and kb_text_shape with the Text module, and compiles in Nuklear,
NukAnim, Onlay and toml-c, and gibus on Linux and the BSDs, so it carries the
zlib, MIT and FreeType License terms above. Each license is copied unchanged
into `licenses/` beside the programs: ship that folder, and this file, with a
binary.
The binary also carries the default assets in `REAKTOR_BUILTINS`, byte for
byte: Water.css's `variables-light.css`, `variables-dark.css` and the nine
files in `src/parts/` (MIT); the seven Ionicons `chevron-down-outline`, `chevron-back-outline`,
`chevron-forward-outline`, `ellipse`, `ellipse-outline`, `radio-button-off`
and `close-outline` (MIT); Aileron Regular and Bold (CC0); and the mark and
`assets/css/reaktor.css` (MIT). Their licenses are in `licenses/` too.
files in `src/parts/` (MIT); the seven Ionicons `chevron-down-outline`,
`chevron-back-outline`, `chevron-forward-outline`, `ellipse`,
`ellipse-outline`, `radio-button-off` and `close-outline` (MIT); Aileron
Regular and Bold (CC0); and the mark and `assets/css/reaktor.css` (MIT).
Their licenses are in `licenses/` too.
The rest of Ionicons, Simple.css, the Japanese font and the catalogs are not
embedded (the catalogs are with `-DREAKTOR_LOCALE_EMBED=ON`); a build that
uses them ships them beside the binary, under the `.reaktor-root` marker,
uses them ships them beside the binary under the `.reaktor-root` marker,
which `tools/package.sh` writes for releases. The WebAssembly build packs the
ones it uses into its `.data` bundle.