Update README

This commit is contained in:
Noah 2020-03-09 17:32:28 -07:00
parent fb9127f0d5
commit 911585ea4d
2 changed files with 20 additions and 7 deletions

View File

@ -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:**

View File

@ -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()
}