-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
35 lines (31 loc) · 840 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 (
rl "github.com/gen2brain/raylib-go/raylib"
c "github.com/nithinputhenveettil/brick-game-car-racing/constants"
"github.com/nithinputhenveettil/brick-game-car-racing/game"
)
func main() {
g := &game.Game{}
g.Reset()
rl.InitWindow(int32(c.Width)+int32(c.Width), int32(c.Length)+int32(c.HeadPading), "Brick Car Racing")
rl.SetTargetFPS(120)
for !rl.WindowShouldClose() {
g.LitsenKeyboardEvents()
rl.BeginDrawing()
rl.ClearBackground(c.BgColor)
if g.GameOver {
g.Draw()
rl.DrawText("Game Over!!", 10, 150, 85, rl.White)
rl.DrawText("Press enter key to continue!", int32(c.Width)-60, int32(c.Length-60), 20, rl.White)
} else if g.Animation.IsActive {
g.Draw()
g.Animation.Animate()
} else {
g.NextTick()
g.CheckGameOver()
g.Draw()
}
rl.EndDrawing()
}
rl.CloseWindow()
}