57 lines
1.1 KiB
Go
57 lines
1.1 KiB
Go
package main
|
|
|
|
// import "github.com/davecgh/go-spew/spew"
|
|
// import "time"
|
|
// import "fmt"
|
|
|
|
import "log"
|
|
import "runtime"
|
|
|
|
import "github.com/andlabs/ui"
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
var splashWin *ui.Window
|
|
|
|
func showSplash() {
|
|
splashWin = ui.NewWindow("", 640, 480, false)
|
|
splashWin.OnClosing(func(*ui.Window) bool {
|
|
ui.Quit()
|
|
return true
|
|
})
|
|
ui.OnShouldQuit(func() bool {
|
|
splashWin.Destroy()
|
|
return true
|
|
})
|
|
|
|
vbox := ui.NewVerticalBox()
|
|
vbox.SetPadded(true)
|
|
splashWin.SetChild(vbox)
|
|
splashWin.SetMargined(true)
|
|
|
|
// This displays the window
|
|
splashWin.Show()
|
|
|
|
makeAttributedString()
|
|
myArea := makeSplashArea()
|
|
|
|
vbox.Append(myArea, true)
|
|
|
|
if runtime.GOOS == "linux" {
|
|
vbox.Append(ui.NewLabel("OS: Linux"), false)
|
|
} else if runtime.GOOS == "windows" {
|
|
vbox.Append(ui.NewLabel("OS: Windows"), false)
|
|
} else {
|
|
vbox.Append(ui.NewLabel("OS: " + runtime.GOOS), false)
|
|
}
|
|
|
|
vbox.Append(ui.NewLabel("Version: v0.3"), false)
|
|
|
|
okButton := ui.NewButton("OK")
|
|
okButton.OnClicked(func(*ui.Button) {
|
|
log.Println("OK. Closing window.")
|
|
splashWin.Destroy()
|
|
ui.Quit()
|
|
})
|
|
vbox.Append(okButton, false)
|
|
}
|