-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
35 lines (27 loc) · 819 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
package main
import (
"fmt"
"log"
"github.com/hajimehoshi/ebiten/v2"
)
func main() {
g := &GameInfo{}
g.Init()
fmt.Println("Arrow Keys to move")
fmt.Println("A key to attack monster when in range")
fmt.Println("U key to pick up loot when in range")
fmt.Println("R key to reset the game")
fmt.Println("F to toggle full screen")
fmt.Println("Q key to quit the game")
mX, mY := ebiten.Monitor().Size()
xScale := float64(g.Board.GetWidth()) / float64(mX)
yScale := float64(g.Board.GetHeight()) / float64(mY)
scale := max(xScale, yScale) * 1.1
ebiten.SetWindowSize(int(float64(g.Board.GetWidth())/scale), int(float64(g.Board.GetHeight())/scale))
ebiten.SetWindowTitle("Basic RPG")
ebiten.SetWindowDecorated(false)
ebiten.SetTPS(15)
if err := ebiten.RunGame(g); err != nil {
log.Fatal(err)
}
}