2019-10-24 09:31:59 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
2020-06-30 12:36:48 -04:00
|
|
|
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2app"
|
2020-06-28 19:31:10 -04:00
|
|
|
ebiten2 "github.com/OpenDiablo2/OpenDiablo2/d2core/d2audio/ebiten"
|
2020-07-08 09:16:16 -04:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2config"
|
2020-01-31 23:18:11 -05:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2input"
|
2020-07-08 09:16:16 -04:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2render/ebiten"
|
2020-01-31 23:18:11 -05:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2term"
|
2020-07-11 11:24:04 -04:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2script"
|
2019-10-24 09:31:59 -04:00
|
|
|
)
|
|
|
|
|
2019-11-06 22:12:15 -05:00
|
|
|
// GitBranch is set by the CI build process to the name of the branch
|
2020-06-30 12:36:48 -04:00
|
|
|
//nolint:gochecknoglobals This is filled in by the build system
|
2019-11-02 16:15:16 -04:00
|
|
|
var GitBranch string
|
2019-11-06 22:12:15 -05:00
|
|
|
|
|
|
|
// GitCommit is set by the CI build process to the commit hash
|
2020-06-30 12:36:48 -04:00
|
|
|
//nolint:gochecknoglobals This is filled in by the build system
|
2019-11-02 16:15:16 -04:00
|
|
|
var GitCommit string
|
2019-10-24 09:31:59 -04:00
|
|
|
|
|
|
|
func main() {
|
2020-01-31 23:18:11 -05:00
|
|
|
log.SetFlags(log.Lshortfile)
|
|
|
|
log.Println("OpenDiablo2 - Open source Diablo 2 engine")
|
|
|
|
|
2020-07-08 09:16:16 -04:00
|
|
|
if err := d2config.Load(); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2020-06-28 19:31:10 -04:00
|
|
|
// Initialize our providers
|
2020-07-03 14:00:56 -04:00
|
|
|
renderer, err := ebiten.CreateRenderer()
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2020-06-30 12:36:48 -04:00
|
|
|
audio, err := ebiten2.CreateAudio()
|
2020-06-28 19:31:10 -04:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2020-08-05 13:51:35 -04:00
|
|
|
inputManager := d2input.NewInputManager()
|
2020-07-13 20:29:17 -04:00
|
|
|
term, err := d2term.New(inputManager)
|
2020-02-08 21:02:37 -05:00
|
|
|
if err != nil {
|
2020-06-24 14:42:39 -04:00
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2020-02-02 14:59:47 -05:00
|
|
|
|
2020-07-11 11:24:04 -04:00
|
|
|
scriptEngine := d2script.CreateScriptEngine()
|
|
|
|
|
2020-07-13 20:29:17 -04:00
|
|
|
app := d2app.Create(GitBranch, GitCommit, inputManager, term, scriptEngine, audio, renderer)
|
2020-07-08 09:16:16 -04:00
|
|
|
if err := app.Run(); err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
2020-06-22 22:17:54 -04:00
|
|
|
}
|