Browse Source

Update README

menus
Noah Petherbridge 2 years ago
parent
commit
911585ea4d
  1. 9
      README.md
  2. 18
      eg/hello-world/main.go

9
README.md

@ -77,9 +77,11 @@ func main() {
Side: ui.N,
})
// Add the button to the MainWindow's Supervisor so it can be
// clicked on and interacted with.
mw.Add(button)
// Add a mouse-over tooltip to the button.
ui.NewTooltip(button, ui.Tooltip{
Text: "You know you want to click this button",
Edge: ui.Right,
})
mw.MainLoop()
}
@ -133,6 +135,7 @@ most complex.
state of the checkbox.
* [x] **Window**: a Frame with a title bar Frame on top.
* Note: Window is not yet draggable or closeable.
* [x] **Tooltip**: a mouse hover label attached to a widget.
**Work in progress widgets:**

18
eg/hello-world/main.go

@ -4,9 +4,14 @@ import (
"fmt"
"git.kirsle.net/go/render"
"git.kirsle.net/go/render/sdl"
"git.kirsle.net/go/ui"
)
func init() {
sdl.DefaultFontFilename = "../DejaVuSans.ttf"
}
func main() {
mw, err := ui.NewMainWindow("Hello World")
if err != nil {
@ -19,10 +24,9 @@ func main() {
label := ui.NewLabel(ui.Label{
Text: "Hello, world!",
Font: render.Text{
FontFilename: "../DejaVuSans.ttf",
Size: 32,
Color: render.SkyBlue,
Shadow: render.SkyBlue.Darken(40),
Size: 32,
Color: render.SkyBlue,
Shadow: render.SkyBlue.Darken(40),
},
})
mw.Pack(label, ui.Pack{
@ -47,5 +51,11 @@ func main() {
Side: ui.N,
})
// Add a mouse-over tooltip to the button.
ui.NewTooltip(button, ui.Tooltip{
Text: "You know you want to click this button",
Edge: ui.Right,
})
mw.MainLoop()
}

Loading…
Cancel
Save