mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
examples: Add comments
This commit is contained in:
parent
f325a70da2
commit
4f3682a130
@ -128,6 +128,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
|
// Change the text color for each second.
|
||||||
if counter%ebiten.FPS == 0 {
|
if counter%ebiten.FPS == 0 {
|
||||||
kanjiText = []rune{}
|
kanjiText = []rune{}
|
||||||
for j := 0; j < 4; j++ {
|
for j := 0; j < 4; j++ {
|
||||||
@ -148,10 +149,16 @@ func update(screen *ebiten.Image) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := fmt.Sprintf("FPS: %0.2f", ebiten.CurrentFPS())
|
|
||||||
const x = 20
|
const x = 20
|
||||||
|
|
||||||
|
// Draw info
|
||||||
|
msg := fmt.Sprintf("FPS: %0.2f", ebiten.CurrentFPS())
|
||||||
text.Draw(screen, msg, mplusNormalFont, x, 40, color.White)
|
text.Draw(screen, msg, mplusNormalFont, x, 40, color.White)
|
||||||
|
|
||||||
|
// Draw the sample text
|
||||||
text.Draw(screen, sampleText, mplusNormalFont, x, 80, color.White)
|
text.Draw(screen, sampleText, mplusNormalFont, x, 80, color.White)
|
||||||
|
|
||||||
|
// Draw Kanji text lines
|
||||||
for i, line := range strings.Split(string(kanjiText), "\n") {
|
for i, line := range strings.Split(string(kanjiText), "\n") {
|
||||||
text.Draw(screen, line, mplusBigFont, x, 160+54*i, kanjiTextColor)
|
text.Draw(screen, line, mplusBigFont, x, 160+54*i, kanjiTextColor)
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,7 @@ func update(screen *ebiten.Image) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Draw the current gamepad status.
|
||||||
str := ""
|
str := ""
|
||||||
if len(ids) > 0 {
|
if len(ids) > 0 {
|
||||||
for _, id := range ids {
|
for _, id := range ids {
|
||||||
|
Loading…
Reference in New Issue
Block a user