edbit/main.go

51 lines
963 B
Go
Raw Normal View History

2021-10-19 01:26:48 +00:00
package main
import (
"log"
"os"
"os/signal"
"syscall"
"code.rocketnine.space/tslocum/edbit/application"
"github.com/hajimehoshi/ebiten/v2"
)
const (
screenWidth = 1024
screenHeight = 768
)
func main() {
ebiten.SetWindowTitle("edbit")
ebiten.SetWindowSize(screenWidth, screenHeight)
ebiten.SetWindowResizable(true)
ebiten.SetFPSMode(ebiten.FPSModeVsyncOffMinimum)
ebiten.SetMaxTPS(60)
ebiten.SetRunnableOnUnfocused(true)
ebiten.SetWindowClosingHandled(true)
ebiten.SetCursorShape(ebiten.CursorShapeCrosshair)
fullscreenWidth, fullscreenHeight := ebiten.ScreenSizeInFullscreen()
if fullscreenWidth <= screenWidth || fullscreenHeight <= screenHeight {
ebiten.SetFullscreen(true)
}
app := application.NewApplication()
sigc := make(chan os.Signal, 1)
signal.Notify(sigc,
syscall.SIGINT,
syscall.SIGTERM)
go func() {
<-sigc
app.Exit()
}()
2021-10-22 09:20:09 +00:00
parseFlags(app)
2021-10-19 01:26:48 +00:00
if err := ebiten.RunGame(app); err != nil {
log.Fatal(err)
}
}