examples/audio: use ebitenutil.DrawCircle

Updates #2250
This commit is contained in:
Hajime Hoshi 2022-08-18 15:42:43 +09:00
parent 1251bd5792
commit 4d03b9fd98

View File

@ -338,10 +338,9 @@ func (p *Player) draw(screen *ebiten.Image) {
// Draw the cursor on the bar. // Draw the cursor on the bar.
c := p.current c := p.current
cw, ch := 8, 20 cx := float64(x) + float64(w)*float64(p.current)/float64(p.total)
cx := int(time.Duration(w)*c/p.total) + x - cw/2 cy := float64(y) + float64(h)/2
cy := y - (ch-h)/2 ebitenutil.DrawCircle(screen, cx, cy, 12, playerCurrentColor)
ebitenutil.DrawRect(screen, float64(cx), float64(cy), float64(cw), float64(ch), playerCurrentColor)
// Compose the curren time text. // Compose the curren time text.
m := (c / time.Minute) % 100 m := (c / time.Minute) % 100