examples/flappy: Add license comment

This commit is contained in:
Hajime Hoshi 2018-05-28 02:38:55 +09:00
parent 5e93d75ae0
commit 5f3a42aab9

View File

@ -64,6 +64,7 @@ const (
screenHeight = 480
tileSize = 32
fontSize = 32
smallFontSize = fontSize / 2
pipeWidth = tileSize * 2
pipeStartOffsetX = 8
pipeIntervalX = 8
@ -71,9 +72,10 @@ const (
)
var (
gopherImage *ebiten.Image
tilesImage *ebiten.Image
arcadeFont font.Face
gopherImage *ebiten.Image
tilesImage *ebiten.Image
arcadeFont font.Face
smallArcadeFont font.Face
)
func init() {
@ -101,6 +103,11 @@ func init() {
DPI: dpi,
Hinting: font.HintingFull,
})
smallArcadeFont = truetype.NewFace(tt, &truetype.Options{
Size: smallFontSize,
DPI: dpi,
Hinting: font.HintingFull,
})
}
var (
@ -247,6 +254,17 @@ func (g *Game) Update(screen *ebiten.Image) error {
text.Draw(screen, l, arcadeFont, x, (i+4)*fontSize, color.White)
}
if g.mode == ModeTitle {
msg := []string{
"Go Gopher by Renee French is",
"licenced under CC BY 3.0.",
}
for i, l := range msg {
x := (screenWidth - len(l)*smallFontSize) / 2
text.Draw(screen, l, smallArcadeFont, x, screenHeight-4+(i-1)*smallFontSize, color.White)
}
}
scoreStr := fmt.Sprintf("%04d", g.score())
text.Draw(screen, scoreStr, arcadeFont, screenWidth-len(scoreStr)*fontSize, fontSize, color.White)
ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %0.2f", ebiten.CurrentFPS()))