mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
examples/flappy: Add license comment
This commit is contained in:
parent
5e93d75ae0
commit
5f3a42aab9
@ -64,6 +64,7 @@ const (
|
|||||||
screenHeight = 480
|
screenHeight = 480
|
||||||
tileSize = 32
|
tileSize = 32
|
||||||
fontSize = 32
|
fontSize = 32
|
||||||
|
smallFontSize = fontSize / 2
|
||||||
pipeWidth = tileSize * 2
|
pipeWidth = tileSize * 2
|
||||||
pipeStartOffsetX = 8
|
pipeStartOffsetX = 8
|
||||||
pipeIntervalX = 8
|
pipeIntervalX = 8
|
||||||
@ -71,9 +72,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
gopherImage *ebiten.Image
|
gopherImage *ebiten.Image
|
||||||
tilesImage *ebiten.Image
|
tilesImage *ebiten.Image
|
||||||
arcadeFont font.Face
|
arcadeFont font.Face
|
||||||
|
smallArcadeFont font.Face
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -101,6 +103,11 @@ func init() {
|
|||||||
DPI: dpi,
|
DPI: dpi,
|
||||||
Hinting: font.HintingFull,
|
Hinting: font.HintingFull,
|
||||||
})
|
})
|
||||||
|
smallArcadeFont = truetype.NewFace(tt, &truetype.Options{
|
||||||
|
Size: smallFontSize,
|
||||||
|
DPI: dpi,
|
||||||
|
Hinting: font.HintingFull,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -247,6 +254,17 @@ func (g *Game) Update(screen *ebiten.Image) error {
|
|||||||
text.Draw(screen, l, arcadeFont, x, (i+4)*fontSize, color.White)
|
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())
|
scoreStr := fmt.Sprintf("%04d", g.score())
|
||||||
text.Draw(screen, scoreStr, arcadeFont, screenWidth-len(scoreStr)*fontSize, fontSize, color.White)
|
text.Draw(screen, scoreStr, arcadeFont, screenWidth-len(scoreStr)*fontSize, fontSize, color.White)
|
||||||
ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %0.2f", ebiten.CurrentFPS()))
|
ebitenutil.DebugPrint(screen, fmt.Sprintf("FPS: %0.2f", ebiten.CurrentFPS()))
|
||||||
|
Loading…
Reference in New Issue
Block a user