/
main.go
40 lines (31 loc) · 838 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package main
import (
"log"
"github.com/fsnotify/fsnotify"
"github.com/hajimehoshi/ebiten/v2"
"github.com/spf13/viper"
)
func init() {
viper.SetConfigName("config")
viper.SetConfigType("json")
viper.AddConfigPath(".")
viper.OnConfigChange(func(e fsnotify.Event) {
log.Printf("Config file changed: %s", e.Name)
})
viper.WatchConfig()
if err := viper.ReadInConfig(); err != nil {
log.Fatal(err)
}
}
func main() {
screenWidth := viper.GetInt("layout.screen.width")
screenHeight := viper.GetInt("layout.screen.height")
input := NewKBHandler()
g := NewGame(input, screenWidth, screenHeight, viper.GetInt("rules.hand_size"))
ebiten.SetWindowTitle(viper.GetString("name"))
ebiten.SetWindowSize(screenWidth, screenHeight)
ebiten.SetFullscreen(true)
if err := ebiten.RunGame(g); err != nil {
log.Fatal(err)
}
}