Skip to content

Commit 4ccee02

Browse files
committed
💚 (ci): fix ci build without ebiten
1 parent 03bb3c7 commit 4ccee02

File tree

9 files changed

+16
-10
lines changed

9 files changed

+16
-10
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ jobs:
2727
- name: Test Build
2828
run: make build-game
2929
- name: Test
30-
run: go test -v ./internal/...
30+
run: go test -v ./internal/game/...

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ run-game: build-game
88

99

1010
coverage:
11-
@go test -v -cover ./...
11+
@go test -v -cover ./internal/game/...
1212

1313
test:
14-
@go test -v ./internal/...
14+
@go test -v ./internal/game/...

cmd/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import (
44
"log"
55

66
"github.com/hajimehoshi/ebiten/v2"
7-
"github.com/leetcode-golang-classroom/2048-game/internal"
7+
"github.com/leetcode-golang-classroom/2048-game/internal/layout"
88
)
99

1010
func main() {
11-
ebiten.SetWindowSize(internal.WinWidth, internal.WinHeight)
11+
ebiten.SetWindowSize(layout.WinWidth, layout.WinHeight)
1212
ebiten.SetWindowTitle("2048 - Day 7 測試")
13-
game := internal.NewGame()
13+
game := layout.NameGameLayout()
1414
if err := ebiten.RunGame(game); err != nil {
1515
log.Fatal(err)
1616
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

internal/layout.go renamed to internal/layout/layout.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package internal
1+
package layout
22

33
import (
44
"image/color"
@@ -14,7 +14,9 @@ const (
1414
WinHeight = tileSize*gridSize + padding*(gridSize+1)
1515
)
1616

17-
func (g *Game) Draw(screen *ebiten.Image) {
17+
type GameLayout struct{}
18+
19+
func (g *GameLayout) Draw(screen *ebiten.Image) {
1820
// 背景色
1921
screen.Fill(color.RGBA{250, 248, 239, 255})
2022
// 畫 4x4 格子
@@ -31,10 +33,14 @@ func (g *Game) Draw(screen *ebiten.Image) {
3133
}
3234
}
3335

34-
func (g *Game) Layout(outsideWidth, outsideHeight int) (int, int) {
36+
func (g *GameLayout) Layout(outsideWidth, outsideHeight int) (int, int) {
3537
return WinWidth, WinHeight
3638
}
3739

38-
func (g *Game) Update() error {
40+
func (g *GameLayout) Update() error {
3941
return nil
4042
}
43+
44+
func NameGameLayout() *GameLayout {
45+
return &GameLayout{}
46+
}

0 commit comments

Comments
 (0)