mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
examples/audio: Improve the seeking message
This commit is contained in:
parent
8957b1b857
commit
7f39dc1e8b
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user