-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
40 lines (31 loc) · 979 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 (
"flag"
"log"
"os"
"github.com/hajimehoshi/ebiten/v2"
)
const (
initialScreenWidth = 1366
initialScreenHeight = 768
)
func main() {
maxDepth := flag.Uint("depth", 7, "set your own maximum quadtree depth")
spriteCount := flag.Uint("sprites", 250, "how many sprites do you want?")
// resizable := flag.Bool("resize", false, "should window be resizable? [true|false] (still experimental) (default false)")
flag.Parse()
ebiten.SetWindowSize(initialScreenWidth, initialScreenHeight)
// if *resizable { ebiten.SetWindowResizingMode(ebiten.WindowResizingModeEnabled) }
ebiten.SetWindowTitle(os.Args[0])
sprites := make([]*Sprite, 0, *spriteCount)
var i uint
for ; i < *spriteCount; i++ {
sprites = append(sprites, NewSprite())
}
root := NewQNode(sprites, 0, initialScreenWidth, 0, initialScreenHeight, 0)
root.generateTree(*maxDepth)
game := &Game{root, *maxDepth}
if err := ebiten.RunGame(game); err != nil {
log.Fatal(err)
}
}