stonecal/main.go

52 lines
896 B
Go

package main
import "bytes"
import "image"
import _ "embed"
import _ "image/png"
import "git.tebibyte.media/sashakoshka/stone"
import _ "git.tebibyte.media/sashakoshka/stone/backends/x"
//go:embed icon/icon64.png
var iconBytes []byte
var application = &stone.Application { }
var state struct {
viewingMonth, currentMonth int
columns, rows, pageSize int
}
var shortMonthNames = []string {
"",
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec",
}
func main () {
application.SetTitle("Calendar")
application.SetSize(20, 8)
icon, _, err := image.Decode(bytes.NewReader(iconBytes))
if err != nil { panic(err) }
application.SetIcon([]image.Image { icon })
application.OnStart(onStart)
application.OnResize(onResize)
application.OnPress(onPress)
application.OnScroll(onScroll)
err = application.Run()
if err != nil { panic(err) }
}