gohan/examples/twinstick/main.go

45 lines
761 B
Go

//go:build example
// +build example
package main
import (
"log"
"os"
"os/signal"
"syscall"
"code.rocketnine.space/tslocum/gohan/examples/twinstick/game"
"github.com/hajimehoshi/ebiten/v2"
)
func main() {
ebiten.SetWindowTitle("Twin-Stick Shooter Example - Gohan")
ebiten.SetWindowResizable(true)
ebiten.SetMaxTPS(144)
ebiten.SetRunnableOnUnfocused(true)
ebiten.SetWindowClosingHandled(true)
ebiten.SetFPSMode(ebiten.FPSModeVsyncOn)
ebiten.SetCursorShape(ebiten.CursorShapeCrosshair)
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)
}
}