Add examples
This commit is contained in:
37
examples/inputs/main.go
Normal file
37
examples/inputs/main.go
Normal file
@@ -0,0 +1,37 @@
|
||||
// Example inputs demonstrates the use of various user input methods.
|
||||
package main
|
||||
|
||||
import "image"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/nasin"
|
||||
import "git.tebibyte.media/tomo/objects"
|
||||
// import "git.tebibyte.media/tomo/tomo/theme"
|
||||
import "git.tebibyte.media/tomo/objects/layouts"
|
||||
|
||||
type Application struct { }
|
||||
|
||||
func (this *Application) Describe () nasin.ApplicationDescription {
|
||||
return nasin.ApplicationDescription {
|
||||
Name: "Tomo Input Example",
|
||||
ID: "xyz.holanet.TomoInputExample",
|
||||
}
|
||||
}
|
||||
|
||||
func (this *Application) Init () error {
|
||||
window, err := nasin.NewApplicationWindow(this, image.Rect(0, 0, 128, 128))
|
||||
if err != nil { return err }
|
||||
|
||||
window.SetRoot(objects.NewOuterContainer(layouts.Column { },
|
||||
objects.NewTextInput(""),
|
||||
objects.NewHorizontalSlider(0.5),
|
||||
objects.NewLabelCheckbox(false, "checkbox"),
|
||||
))
|
||||
|
||||
window.OnClose(tomo.Stop)
|
||||
window.Show()
|
||||
return nil
|
||||
}
|
||||
|
||||
func main () {
|
||||
nasin.RunApplication(&Application { })
|
||||
}
|
||||
Reference in New Issue
Block a user