mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-11-12 07:16:57 -05:00
6f8b43f8d6
* suppressing the magic number lint errors in mapgen, it will get a heavy refactor soon, hopefully... * adding string token constants for SkillClass * adding panic on error to left/right skill select render * fixed cuddle lint error * fixed unnecessary conversion, unused func param lint errors in dcc_animation.go * adding comment for skill class tokens * fixed typo in comment * removed unused parameter in dcc/dc6 animations * supress warning about Object.setMode always being passed direction value of 0 * fixed all invalid golint directives * fixed a couple gocritic lint errors
67 lines
1.6 KiB
Go
67 lines
1.6 KiB
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2app"
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core/d2asset"
|
|
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)
|
|
}
|
|
|
|
// NewAssetManager our providers
|
|
renderer, err := ebiten.CreateRenderer()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
asset, err := d2asset.NewAssetManager(d2config.Config)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
audio, err := ebiten2.CreateAudio(asset)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
inputManager := d2input.NewInputManager()
|
|
|
|
term, err := d2term.New(inputManager)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
err = asset.BindTerminalCommands(term)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
scriptEngine := d2script.CreateScriptEngine()
|
|
|
|
app := d2app.Create(GitBranch, GitCommit, inputManager, term, scriptEngine, audio, renderer, asset)
|
|
if err := app.Run(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|