~bigbes/game-prototype-ftl

ref: 32728014343650c10e124df06fecb28884db0128 game-prototype-ftl/main.go -rw-r--r-- 745 bytes
32728014 — Eugene Blikh docs(skeleton): record review conclusion a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package main

import (
	"image/color"

	"github.com/hajimehoshi/ebiten/v2"
)

// Game holds the top-level state for the Ebitengine run loop.
type Game struct {
	ship Ship
}

// Update advances simulation; nothing to do in this milestone.
func (g *Game) Update() error {
	return nil
}

// Draw renders the whole frame.
func (g *Game) Draw(screen *ebiten.Image) {
	screen.Fill(color.RGBA{10, 15, 25, 255})
	drawShip(screen, g.ship)
}

// Layout fixes the virtual resolution; the window scales to fit.
func (g *Game) Layout(_, _ int) (int, int) {
	return VirtualW, VirtualH
}

func main() {
	ebiten.SetWindowSize(1280, 720)
	ebiten.SetWindowTitle("ftl-shape")
	if err := ebiten.RunGame(&Game{ship: NewPlayerShip()}); err != nil {
		panic(err)
	}
}