Skip to content

Commit

Permalink
adding gel
Browse files Browse the repository at this point in the history
  • Loading branch information
mleku committed Dec 24, 2024
1 parent 27103b1 commit 5ef6fea
Show file tree
Hide file tree
Showing 132 changed files with 66,498 additions and 211 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ node_modules/**
!*.service
!*.benc
!*.png
!*.ttf
!*.sfd

# ...even if they are in subdirectories
!*/
39 changes: 0 additions & 39 deletions cmd/birb/main.go
Original file line number Diff line number Diff line change
@@ -1,43 +1,4 @@
package main

import (
"gioui.org/text"
"image/color"
"gioui.org/widget/material"
"gioui.org/app"
"gioui.org/op"
"gioui.org/font/gofont"
"os"
"log"
)

func main() {
go func() {
w := new(app.Window)
if err := loop(w); err != nil {
log.Fatal(err)
}
os.Exit(0)
}()
app.Main()
}

func loop(w *app.Window) error {
th := material.NewTheme()
th.Shaper = text.NewShaper(text.WithCollection(gofont.Collection()))
var ops op.Ops
for {
switch e := w.Event().(type) {
case app.DestroyEvent:
return e.Err
case app.FrameEvent:
gtx := app.NewContext(&ops, e)
l := material.H1(th, "Hello, Gio")
maroon := color.NRGBA{R: 127, G: 0, B: 0, A: 255}
l.Color = maroon
l.Alignment = text.Middle
l.Layout(gtx)
e.Frame(gtx.Ops)
}
}
}
22 changes: 22 additions & 0 deletions cmd/birb/util.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package main

import (
"bytes"

"realy.lol/context"
"realy.lol/lol"
)

type (
bo = bool
by = []byte
st = string
er = error
no = int
cx = context.T
)

var (
log, chk, errorf = lol.Main.Log, lol.Main.Check, lol.Main.Errorf
equals = bytes.Equal
)
21 changes: 21 additions & 0 deletions gel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# gel

Gio elements

This is a widget toolkit based on the basic set of material widgets built with Gio.

So far, the following additional widgets have been created - scrollbar for the scrolling list, a column and basic table,
and a top-bar side-bar status-bar multi-page application framework, and a background process runner to minimise
interruptions to the rendering of the interfaces.

There is also a state-widget pool generated with the stuff in `poolgen/` that you initialize before starting the render
loop that can then be used anywhere to add new clickables, bools, inputs and so on, without having to double up with a
pre-specification, they allocate first run and then cache thereafter, maintaining their state.

Gel uses fluent programming techniques to simplify and denoise the visual structure of Gio widget definitions. To take
maximum advantage of it, make use of the fact that Go allows breaking lines after dot operators between the chained
methods such that each movable section can be pulled up and moved into another position without dealing with a screenful
of red underlines in your IDE caused by unpaired brackets.

Future plans include creating a serialization format for events and render op queues and accompanying socket transports
to enable remote display and control of user interfaces.
Loading

0 comments on commit 5ef6fea

Please sign in to comment.