Documentation
¶
Overview ¶
Package fluo is the module root for github.com/0xdreadnaught/fluo, a retained-mode, classic Windows-styled GUI toolkit for OpenGL apps in Go. It declares no exported symbols of its own — every usable package lives in a subdirectory (render, text, core, input, theme, controls, bind, anim, timers, app) — this file exists solely to give `go doc .`/pkg.go.dev a landing-page overview, quickstart, and architecture map for the module as a whole.
Quickstart ¶
A minimal program: load a font, build one widget, and drive it from app.Run's per-frame callback.
font, _ := text.Load(goregular.TTF)
root := controls.NewTextBlock(text.NewFace(font, 16), "Hello, fluo!")
log.Fatal(app.Run(app.Config{Title: "hello", Width: 320, Height: 200}, func(c *app.Ctx) {
c.Input.SetRoot(root)
core.MeasureWidget(root, c.Size)
core.ArrangeWidget(root, render.Rect{W: c.Size.W, H: c.Size.H})
core.RenderWidget(root, c.R)
}))
See examples/counter, examples/form, and examples/todo for complete, runnable programs, and cmd/fluo-gallery for every control composed together.
Architecture ¶
fluo is layered bottom to top; each layer only depends on the ones below it:
render — the Renderer interface and geometry primitives (Color/
Point/Size/Rect); render/gl implements it on OpenGL 3.3.
text — font loading, grayscale glyph rasterization into a
coverage atlas, and single-line layout, on top of render.
core — the Widget/Element layout engine (Measure/Arrange/Render)
and the reactive Property[T].
input — hit-testing, event bubbling, capture, and focus over a
core.Widget tree.
theme — the color/metric/typography token model (Light/Dark).
controls — the built-in widget set, styled from theme and wired to
input.
bind — one-way/two-way binding between core.Property[T]/
bind.List[T] and controls.
anim/ — easing/Tween animation and the frame-tick timer service
timers controls use for caret blink, tooltip dwell, and
cross-fades.
app — Run/Surface, the glfw window host (or embeddable surface)
that ties every layer above together into a running
program.
go doc on any of the above (e.g. `go doc ./controls`) gives a one-paragraph summary of its role and key types.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package anim provides easing functions and a frame-driven Tween that interpolates a normalized progress value 0→1 over a duration, using a timers.Queue as its clock.
|
Package anim provides easing functions and a frame-driven Tween that interpolates a normalized progress value 0→1 over a duration, using a timers.Queue as its clock. |
|
Package app provides fluo's desktop window host: Run opens a GLFW window with an OpenGL 3.3 core context, wires up render/gl's Renderer, and drives a frame(*Ctx) callback every vsync until the window closes.
|
Package app provides fluo's desktop window host: Run opens a GLFW window with an OpenGL 3.3 core context, wires up render/gl's Renderer, and drives a frame(*Ctx) callback every vsync until the window closes. |
|
Package bind connects core.Property[T] values to controls: one-way binding pushes a property's value into a control on every change, and two-way binding additionally OWNS a control's OnChanged slot so user edits flow back into the property.
|
Package bind connects core.Property[T] values to controls: one-way binding pushes a property's value into a control on every change, and two-way binding additionally OWNS a control's OnChanged slot so user edits flow back into the property. |
|
cmd
|
|
|
fluo-demo
command
Command fluo-demo is a minimal demo host exercising every fluo primitive: rounded rects, stroke, shadow, SDF text, and a manually hand-rolled hover/press-reactive button (this becomes controls.Button in Phase 5).
|
Command fluo-demo is a minimal demo host exercising every fluo primitive: rounded rects, stroke, shadow, SDF text, and a manually hand-rolled hover/press-reactive button (this becomes controls.Button in Phase 5). |
|
fluo-editor
command
Command fluo-editor is a standalone code-editor demo built on fluo's multi-line TextBox: a monospace editor with a line-number gutter, word-wrap OFF (long lines scroll horizontally), tab-to-indent, mouse-wheel scrolling, and a live Ln/Col status.
|
Command fluo-editor is a standalone code-editor demo built on fluo's multi-line TextBox: a monospace editor with a line-number gutter, word-wrap OFF (long lines scroll horizontally), tab-to-indent, mouse-wheel scrolling, and a live Ln/Col status. |
|
fluo-gallery
command
Command fluo-gallery is the widget gallery: it grows a page per control as phases land.
|
Command fluo-gallery is the widget gallery: it grows a page per control as phases land. |
|
Package controls provides fluo's built-in widget set, all styled from theme.Active() rather than hard-coded values.
|
Package controls provides fluo's built-in widget set, all styled from theme.Active() rather than hard-coded values. |
|
Package core is fluo's layout engine and widget foundation.
|
Package core is fluo's layout engine and widget foundation. |
|
examples
|
|
|
counter
command
Command counter is fluo's smallest example: a Button increments a core.Property[int], and a TextBlock shows the current count via bind.OneWay.
|
Command counter is fluo's smallest example: a Button increments a core.Property[int], and a TextBlock shows the current count via bind.OneWay. |
|
form
command
Command form demonstrates binding several controls to one small model: a TextBox, CheckBox, and Slider each two-way bound to a field of model, and a TextBlock one-way bound to all three, echoing the combined state on every change.
|
Command form demonstrates binding several controls to one small model: a TextBox, CheckBox, and Slider each two-way bound to a field of model, and a TextBlock one-way bound to all three, echoing the combined state on every change. |
|
todo
command
Command todo demonstrates list binding: a TextBox + "Add" Button append to a bind.List[string], a ListView renders it, and a TextBlock tracks the item count — all driven off the same List, with no manual widget rebuilding.
|
Command todo demonstrates list binding: a TextBox + "Add" Button append to a bind.List[string], a ListView renders it, and a TextBlock tracks the item count — all driven off the same List, with no manual widget rebuilding. |
|
Package input turns raw pointer/keyboard/wheel events into dispatch against a core.Widget tree.
|
Package input turns raw pointer/keyboard/wheel events into dispatch against a core.Widget tree. |
|
Package render defines fluo's abstract 2D drawing surface: the Renderer interface (FillRect/FillRoundedRect/StrokeRoundedRect/DrawShadow/ DrawBackdropBlur/DrawQuad/DrawGlyphs plus texture management and clip push/pop) and the plain-data geometry types every other package builds on — Point, Size, Rect (with Thickness-based Inset), and Color (0..1 float components, with RGB/RGBA byte-based constructors).
|
Package render defines fluo's abstract 2D drawing surface: the Renderer interface (FillRect/FillRoundedRect/StrokeRoundedRect/DrawShadow/ DrawBackdropBlur/DrawQuad/DrawGlyphs plus texture management and clip push/pop) and the plain-data geometry types every other package builds on — Point, Size, Rect (with Thickness-based Inset), and Color (0..1 float components, with RGB/RGBA byte-based constructors). |
|
gl
Package gl implements render.Renderer on top of OpenGL 3.3 core.
|
Package gl implements render.Renderer on top of OpenGL 3.3 core. |
|
gl/gltest
Package gltest is a golden-image test harness for OpenGL rendering code.
|
Package gltest is a golden-image test harness for OpenGL rendering code. |
|
Package text provides pure-Go font loading, glyph rasterization, and single-line text layout, built on golang.org/x/image/font/sfnt.
|
Package text provides pure-Go font loading, glyph rasterization, and single-line text layout, built on golang.org/x/image/font/sfnt. |
|
Package theme holds fluo's classic Windows-2000-inspired design tokens.
|
Package theme holds fluo's classic Windows-2000-inspired design tokens. |
|
Package timers provides a frame-driven timer service: Queue holds a set of pending Timer callbacks, and the host calls Advance(now) once per frame to fire whichever are due, in due-time order.
|
Package timers provides a frame-driven timer service: Queue holds a set of pending Timer callbacks, and the host calls Advance(now) once per frame to fire whichever are due, in due-time order. |
