go-sdl2 flappy bird编译
ddatsh
逛gocn发现 好玩的github项目 用go做个flappy bird
https://github.com/neomede/flappy.git
弄成go module项目
go mod init ddatsh.com/flappy
go: creating new go.mod: module ddatsh.com/flappy
go: to add module requirements and sums:
go mod tidy
发现用新版依赖时编译报错
go mod tidy
go: finding module for package github.com/veandco/go-sdl2/sdl_ttf
go: finding module for package github.com/veandco/go-sdl2/sdl_image
ddatsh.com/flappy imports
github.com/veandco/go-sdl2/sdl_image: module github.com/veandco/go-sdl2@latest found (v0.4.29), but does not contain package github.com/veandco/go-sdl2/sdl_image
ddatsh.com/flappy imports
github.com/veandco/go-sdl2/sdl_ttf: module github.com/veandco/go-sdl2@latest found (v0.4.29), but does not contain package github.com/veandco/go-sdl2/sdl_ttf
发现和游戏代码提交时间对应的 go-sdl2的 0.1 tag 里的才是 sdl_image、sdl_ttf,新版就省了sdl_前缀
继续修复几行小变化
.\main.go:56:13: undefined: sdl.KeyUpEvent
.\main.go:72:13: undefined: sdl.KeyUpEvent
.\text.go:38:23: font.RenderUTF8_Solid undefined (type *ttf.Font has no field or method RenderUTF8_Solid)