boxcars/main.go

48 lines
911 B
Go
Raw Normal View History

2021-08-19 06:57:40 +00:00
package main
2023-10-30 06:06:35 +00:00
//go:generate xgotext -no-locations -default boxcars -in . -out game/locales
2021-08-19 06:57:40 +00:00
import (
2024-10-12 05:01:07 +00:00
"image"
2021-08-19 06:57:40 +00:00
"log"
2021-08-26 03:30:04 +00:00
"os"
2021-08-31 04:26:49 +00:00
"os/signal"
"syscall"
2021-08-19 06:57:40 +00:00
2024-10-12 05:01:07 +00:00
"code.rocket9labs.com/tslocum/boxcars/game"
2024-11-19 08:05:38 +00:00
"code.rocket9labs.com/tslocum/gotext"
2021-08-19 06:57:40 +00:00
"github.com/hajimehoshi/ebiten/v2"
)
const (
screenWidth = 1024
screenHeight = 768
)
func main() {
2024-11-19 08:05:38 +00:00
g := parseFlags()
ebiten.SetWindowTitle(gotext.Get("%s - Free Online Backgammon", "bgammon.org"))
2021-08-19 06:57:40 +00:00
ebiten.SetWindowSize(screenWidth, screenHeight)
2023-09-25 04:39:07 +00:00
ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled)
2024-10-12 05:01:07 +00:00
ebiten.SetWindowIcon([]image.Image{game.ImgIconAlt})
2021-08-19 06:57:40 +00:00
2021-08-31 04:26:49 +00:00
sigc := make(chan os.Signal, 1)
signal.Notify(sigc,
syscall.SIGINT,
syscall.SIGTERM)
go func() {
<-sigc
g.Exit()
}()
2024-04-24 17:25:49 +00:00
op := &ebiten.RunGameOptions{
X11ClassName: "boxcars",
X11InstanceName: "boxcars",
}
if err := ebiten.RunGameWithOptions(g, op); err != nil {
2021-08-19 06:57:40 +00:00
log.Fatal(err)
}
}