-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (30 loc) · 711 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"fmt"
g "github.com/Pxe2k/goDungeons/game"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/audio"
"github.com/hajimehoshi/ebiten/v2/audio/wav"
"os"
)
func main() {
ebiten.SetWindowSize(g.ScreenSize())
ebiten.SetWindowTitle("Hasan Game")
//TODO move this code to audio.go file
audioContext := audio.NewContext(44100)
f, err := os.Open("resource/audio/macan-asphalt-8.wav")
if err != nil {
fmt.Println(err)
}
defer f.Close()
d, err := wav.DecodeWithSampleRate(44100, f)
if err != nil {
fmt.Println(err)
}
audioPlayer, err := audioContext.NewPlayer(d)
if err != nil {
fmt.Println(err)
}
audioPlayer.Play()
ebiten.RunGame(g.NewGame())
}