chore(docs): comments

This commit is contained in:
Muhammad Nauman Raza 2023-07-23 00:36:55 +01:00
parent 044f2022e7
commit d525bc8fff

View file

@ -23,6 +23,7 @@ type Game struct {
ui ebitenui.UI ui ebitenui.UI
} }
// Function for UI initialization
func uiInit() ebitenui.UI { func uiInit() ebitenui.UI {
// The `hazakura` colorscheme // The `hazakura` colorscheme
hazakura := make(map[string]color.RGBA) hazakura := make(map[string]color.RGBA)
@ -79,6 +80,7 @@ func (g *Game) Update() error {
// Draw implements Game // Draw implements Game
func (g *Game) Draw(screen *ebiten.Image) { func (g *Game) Draw(screen *ebiten.Image) {
// Draw the UI onto the screen
g.ui.Draw(screen) g.ui.Draw(screen)
} }
@ -87,7 +89,9 @@ func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeigh
return outsideWidth, outsideHeight return outsideWidth, outsideHeight
} }
// Main function
func main() { func main() {
// Randomize window titles!
window_titles := []string{ window_titles := []string{
"coding into the online cyberframe", "coding into the online cyberframe",
"seriously prideful", "seriously prideful",
@ -97,11 +101,17 @@ func main() {
} }
window_title := "Ambition: " + window_titles[rand.Intn(len(window_titles))] window_title := "Ambition: " + window_titles[rand.Intn(len(window_titles))]
// Engine setup
ebiten.SetWindowSize(640, 480) ebiten.SetWindowSize(640, 480)
ebiten.SetWindowTitle(window_title) ebiten.SetWindowTitle(window_title)
// Initialise the game
game := Game{ game := Game{
// Initialise the UI
ui: uiInit(), ui: uiInit(),
} }
// Log and exit on error
if err := ebiten.RunGame(&game); err != nil { if err := ebiten.RunGame(&game); err != nil {
log.Fatal(err) log.Fatal(err)
} }