Multiplayer fighting video game featuring rollback networking
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.0 KiB

package main
import (
"log"
"os"
"os/signal"
"syscall"
"code.rocketnine.space/tslocum/boxbrawl/game"
"code.rocketnine.space/tslocum/boxbrawl/world"
"github.com/hajimehoshi/ebiten/v2"
)
func main() {
ebiten.SetWindowTitle("Box Brawl")
ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)
ebiten.SetWindowSize(world.DefaultScreenWidth, world.DefaultScreenHeight)
ebiten.SetWindowClosingHandled(true)
ebiten.SetRunnableOnUnfocused(true)
parseFlags()
g, err := game.NewGame()
if err != nil {
log.Fatal(err)
}
sigc := make(chan os.Signal, 1)
signal.Notify(sigc,
syscall.SIGINT,
syscall.SIGTERM)
go func() {
<-sigc
g.Exit()
}()
// Run in headless mode.
if world.Headless {
err = g.RunHeadless()
if err != nil {
log.Fatal(err)
}
return
}
// Run normally.
ebiten.SetTPS(world.TPS)
ebiten.SetFullscreen(world.Fullscreen)
if world.DisableVsync {
ebiten.SetFPSMode(ebiten.FPSModeVsyncOffMaximum)
} else {
ebiten.SetFPSMode(ebiten.FPSModeVsyncOn)
}
err = ebiten.RunGame(g)
if err != nil {
log.Fatal(err)
}
}