commandeuropa/main.go

47 lines
883 B
Go
Raw Normal View History

2022-11-09 22:33:27 +00:00
package main
import (
"log"
"os"
"os/signal"
"syscall"
"code.rocketnine.space/tslocum/commandeuropa/game"
"code.rocketnine.space/tslocum/commandeuropa/world"
"github.com/hajimehoshi/ebiten/v2"
)
func main() {
ebiten.SetWindowTitle("Command Europa")
ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)
ebiten.SetWindowSize(world.ScreenWidth, world.ScreenHeight)
ebiten.SetFullscreen(true)
ebiten.SetWindowClosingHandled(true)
ebiten.SetFPSMode(ebiten.FPSModeVsyncOn)
ebiten.SetTPS(world.TPS)
ebiten.SetRunnableOnUnfocused(true)
2022-11-10 07:36:00 +00:00
ebiten.SetCursorShape(ebiten.CursorShapeCrosshair)
2022-11-09 22:33:27 +00:00
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()
}()
err = ebiten.RunGame(g)
if err != nil {
log.Fatal(err)
}
}