examples: Add comments

This commit is contained in:
Hajime Hoshi 2018-01-28 20:10:50 +09:00
parent f325a70da2
commit 4f3682a130
2 changed files with 9 additions and 1 deletions

View File

@ -128,6 +128,7 @@ func init() {
}
func update(screen *ebiten.Image) error {
// Change the text color for each second.
if counter%ebiten.FPS == 0 {
kanjiText = []rune{}
for j := 0; j < 4; j++ {
@ -148,10 +149,16 @@ func update(screen *ebiten.Image) error {
return nil
}
msg := fmt.Sprintf("FPS: %0.2f", ebiten.CurrentFPS())
const x = 20
// Draw info
msg := fmt.Sprintf("FPS: %0.2f", ebiten.CurrentFPS())
text.Draw(screen, msg, mplusNormalFont, x, 40, color.White)
// Draw the sample text
text.Draw(screen, sampleText, mplusNormalFont, x, 80, color.White)
// Draw Kanji text lines
for i, line := range strings.Split(string(kanjiText), "\n") {
text.Draw(screen, line, mplusBigFont, x, 160+54*i, kanjiTextColor)
}

View File

@ -54,6 +54,7 @@ func update(screen *ebiten.Image) error {
return nil
}
// Draw the current gamepad status.
str := ""
if len(ids) > 0 {
for _, id := range ids {