From d525bc8fff513d5f2a1b9c3dfa7b633ae54c6b82 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Sun, 23 Jul 2023 00:36:55 +0100 Subject: [PATCH] chore(docs): comments --- frontend/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend/main.go b/frontend/main.go index c4930a7..f0ac623 100644 --- a/frontend/main.go +++ b/frontend/main.go @@ -23,6 +23,7 @@ type Game struct { ui ebitenui.UI } +// Function for UI initialization func uiInit() ebitenui.UI { // The `hazakura` colorscheme hazakura := make(map[string]color.RGBA) @@ -79,6 +80,7 @@ func (g *Game) Update() error { // Draw implements Game func (g *Game) Draw(screen *ebiten.Image) { + // Draw the UI onto the screen g.ui.Draw(screen) } @@ -87,7 +89,9 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeigh return outsideWidth, outsideHeight } +// Main function func main() { + // Randomize window titles! window_titles := []string{ "coding into the online cyberframe", "seriously prideful", @@ -97,11 +101,17 @@ func main() { } window_title := "Ambition: " + window_titles[rand.Intn(len(window_titles))] + // Engine setup ebiten.SetWindowSize(640, 480) ebiten.SetWindowTitle(window_title) + + // Initialise the game game := Game{ + // Initialise the UI ui: uiInit(), } + + // Log and exit on error if err := ebiten.RunGame(&game); err != nil { log.Fatal(err) }