mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
examples/platformer: add more descrpitive comments (#2866)
This commit is contained in:
parent
b8df1217c3
commit
c80a82c501
@ -113,6 +113,7 @@ func (c *char) draw(screen *ebiten.Image) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
|
// Use a smaller scale than 1 to shrink the image.
|
||||||
op.GeoM.Scale(0.5, 0.5)
|
op.GeoM.Scale(0.5, 0.5)
|
||||||
op.GeoM.Translate(float64(c.x)/unit, float64(c.y)/unit)
|
op.GeoM.Translate(float64(c.x)/unit, float64(c.y)/unit)
|
||||||
screen.DrawImage(s, op)
|
screen.DrawImage(s, op)
|
||||||
@ -141,15 +142,15 @@ func (g *Game) Update() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) Draw(screen *ebiten.Image) {
|
func (g *Game) Draw(screen *ebiten.Image) {
|
||||||
// Draws Background Image
|
// Draws Background Image.
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
op.GeoM.Scale(0.5, 0.5)
|
op.GeoM.Scale(0.5, 0.5)
|
||||||
screen.DrawImage(backgroundImage, op)
|
screen.DrawImage(backgroundImage, op)
|
||||||
|
|
||||||
// Draws the Gopher
|
// Draws the Gopher.
|
||||||
g.gopher.draw(screen)
|
g.gopher.draw(screen)
|
||||||
|
|
||||||
// Show the message
|
// Show the message.
|
||||||
msg := fmt.Sprintf("TPS: %0.2f\nPress the space key to jump.", ebiten.ActualTPS())
|
msg := fmt.Sprintf("TPS: %0.2f\nPress the space key to jump.", ebiten.ActualTPS())
|
||||||
ebitenutil.DebugPrint(screen, msg)
|
ebitenutil.DebugPrint(screen, msg)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user