examples/audio: Improve the seeking message

This commit is contained in:
Hajime Hoshi 2017-06-04 17:12:31 +09:00
parent 8957b1b857
commit 7f39dc1e8b

View File

@ -93,6 +93,7 @@ type Player struct {
seBytes []uint8
seCh chan []uint8
volume128 int
previousPos time.Duration
}
var (
@ -249,6 +250,8 @@ func (p *Player) draw(screen *ebiten.Image) {
screen.DrawImage(playerBarImage, op)
currentTimeStr := "00:00"
c := p.audioPlayer.Current()
prev := p.previousPos
p.previousPos = c
// Current Time
m := (c / time.Minute) % 100
@ -268,8 +271,8 @@ Press S to toggle Play/Pause
Press P to play SE
Press Z or X to change volume of the music
%s`, ebiten.CurrentFPS(), currentTimeStr)
if p.seekedCh != nil {
msg += "\nSeeking..."
if p.audioPlayer.IsPlaying() && prev == c {
msg += "\nLoading..."
}
ebitenutil.DebugPrint(screen, msg)
}