51 lines
963 B
Go
51 lines
963 B
Go
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()
|
|
}()
|
|
|
|
parseFlags(app)
|
|
|
|
if err := ebiten.RunGame(app); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|