Add version number and documentation

Этот коммит содержится в:
Noah 2020-03-09 17:29:17 -07:00
родитель f9b305679a
Коммит fb9127f0d5
4 изменённых файлов: 45 добавлений и 5 удалений

10
docs.go Обычный файл
Просмотреть файл

@ -0,0 +1,10 @@
/*
Package ui provides a user interface toolkit for Go.
The UI toolkit targets SDL2 applications on desktop (Linux, Mac and Windows)
or an HTML Canvas render engine for web browsers.
It provides various widgets such as Frame, Label, Button, Checkbox, Radiobox
and Tooltip and an event supervisor to monitor the state of the widgets.
*/
package ui

6
go.mod
Просмотреть файл

@ -2,8 +2,4 @@ module git.kirsle.net/go/ui
go 1.13
require (
git.kirsle.net/go/render v0.0.0-20200102014411-4d008b5c468d
github.com/veandco/go-sdl2 v0.4.1 // indirect
golang.org/x/image v0.0.0-20200119044424-58c23975cae1 // indirect
)
require git.kirsle.net/go/render v0.0.0-20200102014411-4d008b5c468d

30
tooltip_test.go Обычный файл
Просмотреть файл

@ -0,0 +1,30 @@
package ui_test
import "git.kirsle.net/go/ui"
// Tooltip usage example.
func ExampleTooltip() {
mw, err := ui.NewMainWindow("Tooltip Example", 800, 600)
if err != nil {
panic(err)
}
// Add a widget that will have a tooltip attached, i.e. a button.
btn := ui.NewButton("My Button", ui.NewLabel(ui.Label{
Text: "Hello world!",
}))
mw.Place(btn, ui.Place{
Center: true,
Middle: true,
})
// Add a tooltip to it. The tooltip attaches itself to the button's
// MouseOver, MouseOut, Compute and Present handlers -- you don't need to
// place the tooltip inside the window or parent frame.
ui.NewTooltip(btn, ui.Tooltip{
Text: "This is a tooltip that pops up\non mouse hover!",
Edge: ui.Right,
})
mw.MainLoop()
}

4
version.go Обычный файл
Просмотреть файл

@ -0,0 +1,4 @@
package ui
// Version of the UI toolkit.
const Version = "0.1.0"