This repository has been archived on 2024-03-23. You can view files and clone it, but cannot push or open issues or pull requests.
ambition-legacy/frontend/main.go
2023-07-22 22:19:15 +01:00

52 lines
1 KiB
Go

package main
import (
"log"
"github.com/ebitenui/ebitenui"
"github.com/ebitenui/ebitenui/image"
"github.com/ebitenui/ebitenui/widget"
"github.com/hajimehoshi/ebiten/v2"
img "image"
"image/color"
)
type Game struct{
ui ebitenui.UI
}
func uiInit() ebitenui.UI {
ui := ebitenui.UI{
Container: widget.NewContainer(widget.ContainerOpts.Layout(widget.NewAnchorLayout())),
}
leftBar := widget.NewContainer(widget.ContainerOpts.BackgroundImage(image.NewNineSliceColor(color.White)))
leftBar.SetLocation(img.Rect(0, 0, 1, 1))
ui.Container.AddChild(leftBar)
return ui
}
func (g *Game) Update() error {
g.ui.Update()
return nil
}
func (g *Game) Draw(screen *ebiten.Image) {
g.ui.Draw(screen)
}
func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) {
return 320, 240
}
func main() {
ebiten.SetWindowSize(640, 480)
ebiten.SetWindowTitle("ambition: seriously prideful")
game := Game{
ui: uiInit(),
}
if err := ebiten.RunGame(&game); err != nil {
log.Fatal(err)
}
}