mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +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
|
seBytes []uint8
|
||||||
seCh chan []uint8
|
seCh chan []uint8
|
||||||
volume128 int
|
volume128 int
|
||||||
|
previousPos time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -249,6 +250,8 @@ func (p *Player) draw(screen *ebiten.Image) {
|
|||||||
screen.DrawImage(playerBarImage, op)
|
screen.DrawImage(playerBarImage, op)
|
||||||
currentTimeStr := "00:00"
|
currentTimeStr := "00:00"
|
||||||
c := p.audioPlayer.Current()
|
c := p.audioPlayer.Current()
|
||||||
|
prev := p.previousPos
|
||||||
|
p.previousPos = c
|
||||||
|
|
||||||
// Current Time
|
// Current Time
|
||||||
m := (c / time.Minute) % 100
|
m := (c / time.Minute) % 100
|
||||||
@ -268,8 +271,8 @@ Press S to toggle Play/Pause
|
|||||||
Press P to play SE
|
Press P to play SE
|
||||||
Press Z or X to change volume of the music
|
Press Z or X to change volume of the music
|
||||||
%s`, ebiten.CurrentFPS(), currentTimeStr)
|
%s`, ebiten.CurrentFPS(), currentTimeStr)
|
||||||
if p.seekedCh != nil {
|
if p.audioPlayer.IsPlaying() && prev == c {
|
||||||
msg += "\nSeeking..."
|
msg += "\nLoading..."
|
||||||
}
|
}
|
||||||
ebitenutil.DebugPrint(screen, msg)
|
ebitenutil.DebugPrint(screen, msg)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user