Hey all, I've been tinkering with the Figuro API a bit:
* The implicit variable for each widget block was renamed from `current` to
`node`. It's shorter and a bit clearer IMHO.
* I turned all the node styling API's into proc's which take an explicit
Figuro node. I may re-add the more Fidget style API with an implicit node
argument as a layer later but wanted typed proc's for the core API. Currently
I'm using `std/with` to pass the node to the styling API's.
* The widget template blocks now use named keyword args rather than the
previous parenthesis style. I feel this is more consistent with Nim syntax
style.
* There's some initial support for frames to support multiple windows. The
API sorta works but the underlying opengl rendering and keyboard events has
issues so unfortunately no multi-windows yet
* Some early font layout glitches are fixed! Combining multiple fonts in a
single text box was broken but now seems to be working fine.
Example:
proc draw*(self: Main) {.slot.} =
rectangle "body", parent=self:
with node:
box 10'ux, 10'ux, 600'ux, 120'ux
cornerRadius 10.0
fill whiteColor.darken(self.bkgFade.amount)
horizontal "horiz":
offset node, 10'ux, 0'ux
itemWidth node, cx"min-content", gap = 20'ui
for i in 0 .. 4:
button "btn", captures=i:
size node, 100'ux, 100'ux
connect(node, doHover, self, buttonHover)
var main = Main.new()
let frame = newAppFrame(main, size=(720'ui, 140'ui))
startFiguro(frame)
Run