From 0b3803c8adc6bae367c398e7d461b9ddfda85638 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Sat, 22 Jul 2023 23:40:06 +0100 Subject: [PATCH] feat: random window titles --- frontend/go.mod | 3 +-- frontend/main.go | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/frontend/go.mod b/frontend/go.mod index 22fbfc9..2f5958c 100644 --- a/frontend/go.mod +++ b/frontend/go.mod @@ -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 diff --git a/frontend/main.go b/frontend/main.go index 6cd868c..cdb74c7 100644 --- a/frontend/main.go +++ b/frontend/main.go @@ -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(), }