Minifb-UI
A lightweight UI library built on top of minifb, providing high-level abstractions for creating windows and interactive UI elements with SDF-based anti-aliased rendering.
Features
- Window management with direct framebuffer access and configurable anti-aliasing
- Drawing primitives: rounded rectangles, circles, ellipses, lines, gradients, bezier curves -- all SDF-based with smooth AA
- Alpha blending and background blur (
blur_region,blur_region_rounded) for frosted glass effects - Box shadows with configurable offset, spread, and blur
- TTF/OTF font rendering via fontdue with text measurement and centered drawing
- UI components:
Button-- push or toggle, 3-state (idle/hovered/clicked), builder pattern, inset shadows, rounded cornersSlider-- numeric range slider with customizable track, handle, and borderTextInput-- text entry with cursor, scrolling, keyboard input, placeholder textSwitch-- sliding toggle with animation
- Color utilities: RGBA, hex parsing, HSV conversion, lerp, complement
Example Usage
use ;
Demo
The included main.rs implements a full mock desktop environment showcasing all components:
- Frosted glass taskbar with start menu, calendar, and notification center
- Draggable app windows (Files, Terminal, Notes, Calculator, Settings) with background blur and transparency
- Light/dark mode toggle via the
Switchcomponent - Functional calculator, file browser, and settings panel with live switches
Run it with:
AI Disclosure
The majority of the code in this crate was written by Claude, guided by detailed instructions specifying the exact architecture, component APIs, rendering approaches, and visual design. I directed what to build, how each component should work, and what the final result should look like so Claude could implement it.