forked from OpenDiablo2/OpenDiablo2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
54 lines (43 loc) · 1.33 KB
/
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"log"
"github.com/OpenDiablo2/OpenDiablo2/d2app"
ebiten2 "github.com/OpenDiablo2/OpenDiablo2/d2core/d2audio/ebiten"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2config"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2input"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2render/ebiten"
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2term"
"github.com/OpenDiablo2/OpenDiablo2/d2script"
)
// GitBranch is set by the CI build process to the name of the branch
//nolint:gochecknoglobals This is filled in by the build system
var GitBranch string
// GitCommit is set by the CI build process to the commit hash
//nolint:gochecknoglobals This is filled in by the build system
var GitCommit string
func main() {
log.SetFlags(log.Lshortfile)
log.Println("OpenDiablo2 - Open source Diablo 2 engine")
if err := d2config.Load(); err != nil {
panic(err)
}
// Initialize our providers
renderer, err := ebiten.CreateRenderer()
if err != nil {
panic(err)
}
audio, err := ebiten2.CreateAudio()
if err != nil {
panic(err)
}
inputManager := d2input.New()
term, err := d2term.New(inputManager)
if err != nil {
log.Fatal(err)
}
scriptEngine := d2script.CreateScriptEngine()
app := d2app.Create(GitBranch, GitCommit, inputManager, term, scriptEngine, audio, renderer)
if err := app.Run(); err != nil {
log.Fatal(err)
}
}