-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
59 lines (44 loc) · 851 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
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"os"
"github.com/hajimehoshi/ebiten/v2"
log "github.com/sirupsen/logrus"
)
const (
screenWidth = 1920
screenHeight = 1080
)
var game *Game
type Rect struct {
X, Y, W, H float64
}
type Vector struct {
VX, VY float64
}
func main() {
ebiten.SetWindowTitle("pongo")
c := NewConfig().Load()
ebiten.SetWindowSize(c.Width, c.Height)
ebiten.SetFullscreen(c.Fullscreen)
if len(os.Args) > 1 && os.Args[1] == "-d" {
c.Debug = true
}
if c.Debug {
log.SetLevel(log.DebugLevel)
}
game = NewGame(c)
if !c.Offline {
go game.net.Announce()
game.net.Listen()
go game.net.SendState(game)
}
go game.RecordFPS()
ebiten.SetMaxTPS(c.TicksPerSecond)
if c.DisableVSync {
ebiten.SetFPSMode(ebiten.FPSModeVsyncOffMaximum)
}
if err := ebiten.RunGame(game); err != nil {
log.Fatal(err)
}
// select {}
}