Get view-menu to play the interface sound

This commit is contained in:
2020-03-21 23:45:51 +00:00
parent 83aa1c4768
commit bcaf3d9b58
7 changed files with 151 additions and 21 deletions

View File

@@ -7,12 +7,12 @@ import (
"os"
"path/filepath"
"github.com/hajimehoshi/ebiten"
"code.ur.gs/lupine/ordoor/internal/assetstore"
"code.ur.gs/lupine/ordoor/internal/data"
"code.ur.gs/lupine/ordoor/internal/menus"
"code.ur.gs/lupine/ordoor/internal/ui"
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/audio"
)
var (
@@ -76,6 +76,20 @@ func main() {
menuObjs = append(menuObjs, obj)
}
// Yay sound
if _, err := audio.NewContext(48000); err != nil {
log.Fatalf("Failed to audio: %v", err)
}
music, err := assets.Sound("music_interface") // FIXME: should be a reference to Sounds.dat
if err != nil {
log.Fatalf("Failed to find interface music: %v", err)
}
player, err := music.InfinitePlayer()
if err != nil {
log.Fatalf("Failed to generate music player for interface: %v", err)
}
player.Play()
state := state{}
env := &env{
menu: menu,