I wrote a GUI toolkit from scratch — window creation, message loop, GPU
rendering, widgets, layout, text and IME, all in one static library. No Qt,
no SDL, no GLFW.
Then I counted the lines. 87,094. And wrote down where the time actually went.
What Zekit is
- One static library. Downstream projects link a single file. No FreeType install, no Vulkan SDK, no third-party setup.
- Hand-written window layers. Win32 and X11 directly. No SDL, no GLFW, no Qt.
- Three render backends. D3D12, Vulkan and OpenGL on Windows; OpenGL (EGL) and Vulkan on Linux. All of them consume the same display list, so the same UI looks the same everywhere.
-
Value-semantic widget tree. Widgets are stack locals.
win.AddWidget(btn)hands them over; nonew, nodelete. - Real IME. IMM32 integration, composition drawn in place, candidate window following the caret.
The four things that actually cost time
1. The same concept, three APIs, three lifetime models.
In OpenGL you can delete a texture whenever you like; the driver synchronizes for you. Vulkan and D3D12 do not. You maintain fences, frame slots and a deferred release queue. "Learning three APIs" really means maintaining three non-equivalent resource lifetimes and making them look like one DrawFrame.
2. Visual consistency is pixel-level, not API-level.
SDF anti-aliasing has to fade over exactly one pixel, to match the hardware MSAA transition width. I once wrote three pixels, and every shape in the library went soft. Bandwidth, gradient math and geometry padding are one set of coupled invariants — change one and the other two must follow.
3. Platform cost is a difference set, not a constant.
Win32's window layer is 2,146 lines. X11's is 3,370 — 55% larger, not smaller. Twenty EWMH atoms, and missing one makes the window manager misbehave in ways you will never see on your own machine, because your WM happens to be forgiving.
4. The IME.
Not D3D12. Where the composition is drawn, which window the candidates follow, when it counts as a commit, where backspace goes. A state machine with nothing to do with the GPU that eats half your debugging time, because the bugs are "sometimes".
The ledger
| Part | Lines |
|---|---|
| Win32 window layer | 2,146 |
| X11 window layer | 3,370 |
| D3D12 / Vulkan / OpenGL | 4,823 |
| Software rasterizer | 792 |
| FreeType + IME | 1,582 |
| Widgets, layout, theme, events | ~74,000 |
| Total | 87,094 |
Fewer than 7% of those lines touch the GPU.
Honest status
Windows 10/11 x64 is primary: D3D12, OpenGL 4.6, Vulkan 1.0+. Linux x64 is supported: EGL OpenGL and Vulkan, X11 only — no Wayland yet.
macOS, iOS, Android and HarmonyOS have source in the tree and are not offered as working targets. The layering made them cheap to write; it did not finish them.
Build it
cmake --preset windows-msvc
cmake --build --preset windows-msvc-release
Output is x64\Release\Zekit.lib. On Linux, cmake --preset linux-release.
#include <Zekit.h>
#include <ZeButton.h>
int main() {
Kit::Window win;
Kit::Button btn("OK");
btn.SetSize(220, 60);
btn.SetOnClick([] { /* ... */ });
win.AddWidget(btn);
win.Show();
return win.exec();
}
MIT licensed. If you only want a button that clicks, use Qt or Dear ImGui — this
breakdown is for people who want to know how the bottom layer actually turns.
Z-ze489
/
Zekit
Self-contained C++20 desktop GUI toolkit for Windows and Linux. One static library: window, D3D12/OpenGL/Vulkan renderer, 80+ widgets, layout, themes, IME. No SDKs to install.
Zekit
A self-contained C++20 desktop GUI toolkit for Windows and Linux.
Window creation, message loop, GPU rendering, widgets, layout, text and IME are all in one static library. Downstream projects link a single file — no FreeType install no Vulkan SDK, no third-party setup.
Control Gallery — every widget in the library, in one window. Light and dark
themes, switched at run time. Ships in examples/gallery.
Highlights
-
Value-semantic widget tree. Widgets are plain values: build them on the stack
hand them to the window with
win.AddWidget(btn), done. Nonew, nodelete, no keeping a member alive. Destruction unregisters automatically. - GPU rendering, three backends. Windows defaults to D3D12 (auto-falls back to OpenGL 4.6 Core) and can switch to Vulkan 1.0+. Linux runs OpenGL (EGL) or Vulkan All backends share the same widget layer and display list, so the same UI looks the same everywhere. The backend is…

Top comments (0)