diff options
Diffstat (limited to 'go/dummy-ui')
| -rw-r--r-- | go/dummy-ui/main.go | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/go/dummy-ui/main.go b/go/dummy-ui/main.go new file mode 100644 index 00000000..48474b33 --- /dev/null +++ b/go/dummy-ui/main.go @@ -0,0 +1,46 @@ +package main + +import ( + "fmt" + + "github.com/hajimehoshi/ebiten/v2" + + "muhq.space/muhqs-game/go/font" + "muhq.space/muhqs-game/go/ui" +) + +type app struct { + ui.Collection + windowWidth int + windowHeight int +} + +func (a *app) Update() error { + if a.Widgets() == nil { + a.build() + } + + return a.Collection.Update() +} + +func (a *app) build() { + nc := ui.NewNumberChoice(a.windowWidth-ui.NUMBER_CHOICE_WIDTH, + a.windowHeight-ui.NUMBER_CHOICE_HEIGHT, + 0, + func(nc *ui.NumberChoice) { + fmt.Println(nc.GetChoosen()) + }) + a.AddWidget(nc) +} + +func (a *app) Layout(width, height int) (int, int) { + return a.windowWidth, a.windowHeight +} + +func main() { + font.InitFont() + app := &app{windowWidth: 800, windowHeight: 1000} + ebiten.SetWindowSize(app.windowWidth, app.windowHeight) + ebiten.SetWindowTitle("Muhq's Game") + ebiten.RunGame(app) +} |
