48 lines
959 B
Go
48 lines
959 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"os/signal"
|
|
"syscall"
|
|
|
|
"code.rocketnine.space/tslocum/pretzel-tycoon/game"
|
|
"code.rocketnine.space/tslocum/pretzel-tycoon/world"
|
|
"github.com/hajimehoshi/ebiten/v2"
|
|
)
|
|
|
|
func main() {
|
|
ebiten.SetWindowTitle("Pretzel Tycoon")
|
|
ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)
|
|
ebiten.SetWindowSize(world.DefaultScreenWidth, world.DefaultScreenHeight)
|
|
ebiten.SetWindowClosingHandled(true)
|
|
ebiten.SetCursorMode(ebiten.CursorModeHidden)
|
|
ebiten.SetRunnableOnUnfocused(true)
|
|
ebiten.SetTPS(world.DefaultTPS)
|
|
ebiten.SetScreenClearedEveryFrame(false)
|
|
|
|
parseFlags()
|
|
|
|
ebiten.SetFullscreen(world.Fullscreen)
|
|
ebiten.SetVsyncEnabled(!world.DisableVsync)
|
|
|
|
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)
|
|
}
|
|
}
|