feat: random window titles

This commit is contained in:
Muhammad Nauman Raza 2023-07-22 23:40:06 +01:00
parent ce42172eaf
commit 0b3803c8ad
2 changed files with 22 additions and 7 deletions

View file

@ -4,9 +4,7 @@ go 1.20
require (
github.com/ebitenui/ebitenui v0.5.4
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
github.com/hajimehoshi/ebiten/v2 v2.5.5
golang.org/x/image v0.7.0
)
require (
@ -14,6 +12,7 @@ require (
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b // indirect
github.com/jezek/xgb v1.1.0 // indirect
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 // indirect
golang.org/x/image v0.7.0 // indirect
golang.org/x/mobile v0.0.0-20230427221453-e8d11dd0ba41 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.8.0 // indirect

View file

@ -1,17 +1,24 @@
package main
import (
// Image-related packages
img "image"
"image/color"
// Random
"math/rand"
// Logs
"log"
// Ebitengine
"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{
type Game struct {
ui ebitenui.UI
}
@ -22,7 +29,7 @@ func uiInit() ebitenui.UI {
leftBar := widget.NewContainer(widget.ContainerOpts.BackgroundImage(image.NewNineSliceColor(color.White)))
leftBar.SetLocation(img.Rect(0, 0, 1, 1))
ui.Container.AddChild(leftBar)
return ui
}
@ -40,8 +47,17 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeigh
}
func main() {
window_titles := []string{
"coding into the online cyberframe",
"seriously prideful",
"[REDACTED]",
"just another day of shooting down bevies",
"mud is delicious",
}
window_title := "Ambition: " + window_titles[rand.Intn(len(window_titles))]
ebiten.SetWindowSize(640, 480)
ebiten.SetWindowTitle("ambition: seriously prideful")
ebiten.SetWindowTitle(window_title)
game := Game{
ui: uiInit(),
}