-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
46 lines (38 loc) · 841 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
41
42
43
44
45
46
package main
import (
_ "image/png"
"log"
"math/rand"
"time"
"golang.org/x/image/font"
"golang.org/x/image/font/opentype"
"github.com/hajimehoshi/ebiten/v2"
"github.com/hajimehoshi/ebiten/v2/examples/resources/fonts"
"github.com/samuelyuan/HexEmpireMap/hexempire"
)
var (
textFont font.Face
)
func init() {
rand.Seed(time.Now().UnixNano())
tt, err := opentype.Parse(fonts.MPlus1pRegular_ttf)
if err != nil {
log.Fatal(err)
}
textFont, err = opentype.NewFace(tt, &opentype.FaceOptions{
Size: 12,
DPI: 72,
Hinting: font.HintingFull,
})
if err != nil {
log.Fatal(err)
}
}
func main() {
game := hexempire.NewGame(textFont)
ebiten.SetWindowSize(game.ScreenWidth, game.ScreenHeight)
ebiten.SetWindowTitle("Hex Empire Map Generator")
if err := ebiten.RunGame(game); err != nil {
log.Fatal(err)
}
}