2026-07-16 15:28:13 +08:00
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
2026-07-16 15:43:03 +08:00
|
|
|
"log"
|
|
|
|
|
"os"
|
2026-07-16 15:28:13 +08:00
|
|
|
|
2026-07-16 15:43:03 +08:00
|
|
|
"gioui.org/app"
|
|
|
|
|
"gioui.org/op"
|
|
|
|
|
"gioui.org/unit"
|
|
|
|
|
|
|
|
|
|
"softbox.local/app-modern/platform/windows"
|
|
|
|
|
softboxgio "softbox.local/app-modern/ui/gio"
|
2026-07-16 15:28:13 +08:00
|
|
|
"softbox.local/core"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func main() {
|
2026-07-16 15:43:03 +08:00
|
|
|
go func() {
|
|
|
|
|
if err := run(); err != nil {
|
|
|
|
|
log.Printf("%s stopped: %v", core.ProductName, err)
|
|
|
|
|
}
|
|
|
|
|
os.Exit(0)
|
|
|
|
|
}()
|
|
|
|
|
app.Main()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func run() error {
|
|
|
|
|
platform := windows.New()
|
|
|
|
|
window := new(app.Window)
|
|
|
|
|
window.Option(
|
|
|
|
|
app.Title(core.ProductName),
|
|
|
|
|
app.Size(unit.Dp(1080), unit.Dp(720)),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
theme := softboxgio.NewTheme()
|
|
|
|
|
shell := softboxgio.NewAppShell(string(platform.Edition()))
|
|
|
|
|
var operations op.Ops
|
|
|
|
|
|
|
|
|
|
for {
|
|
|
|
|
switch event := window.Event().(type) {
|
|
|
|
|
case app.DestroyEvent:
|
|
|
|
|
return event.Err
|
|
|
|
|
case app.FrameEvent:
|
|
|
|
|
context := app.NewContext(&operations, event)
|
|
|
|
|
shell.Layout(context, theme)
|
|
|
|
|
event.Frame(context.Ops)
|
|
|
|
|
}
|
|
|
|
|
}
|
2026-07-16 15:28:13 +08:00
|
|
|
}
|