-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
117 lines (87 loc) · 1.73 KB
/
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package main
import (
"os"
rl "github.com/gen2brain/raylib-go/raylib"
)
const (
screenWidth = 540
screenHeight = 900
maxParticleCount = 100 // Capped to 100 (for now)
spriteSize = 48
gravity = 1.2
acceleration = 0.5
)
var (
// Colors
// Game Variables (Non-constant)
gameName string = ("")
game Game
)
type Game struct {
GameOver bool
Dead bool
Paused bool
Score int32
HighScore int32
FramesCounter int32
Particles []Particle
}
type Particle struct {
Position rl.Vector2
Color rl.Color
Alpha float32
Size float32
Rotation float32
Active bool
}
// NewGame - Start new game
func NewGame() (g Game) {
g.Init()
return
}
// func::init
// Initializes the game state and all its components (android_main).
func init() {
rl.SetCallbackFunc(main)
}
func main() {
// Initialize game
game := NewGame()
game.GameOver = true
// Initialize window
rl.InitWindow(screenWidth, screenHeight, "")
// Initialize audio
rl.InitAudioDevice()
// NOTE: Textures and Sounds MUST be loaded after Window/Audio initialization
game.Load()
// Limit FPS
rl.SetTargetFPS(60)
// Free resources
game.Unload()
// Close audio
rl.CloseAudioDevice()
// Close window
rl.CloseWindow()
// Exit
os.Exit(0)
}
// func::Init
// Initializes the game state and all its components.
func (g *Game) Init() {
}
// func::Load
// Loads all resources from a given path.
func (g *Game) Load() {
}
// func::Unload
// Unloads all resources that were previously loaded in.
func (g *Game) Unload() {
}
// func::Update
// Updates the internal game logic and state.
func (g *Game) Update() {
}
// func::Draw
// Draws the game state and all its components to the screen.
func (g *Game) Draw() {
}