-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.odin
47 lines (31 loc) · 793 Bytes
/
main.odin
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
package snake
import "core:fmt"
import "core:strings"
import rl "vendor:raylib"
import imgui_rl "imgui_impl_raylib"
import imgui "odin-imgui"
main :: proc() {
// raylib setup
rl.SetConfigFlags({.VSYNC_HINT })
rl.InitWindow(WINDOW_SIZE, WINDOW_SIZE, "snake")
rl.SetTargetFPS(60)
defer rl.CloseWindow()
// imgui setup
imgui.CreateContext()
defer imgui.DestroyContext()
imgui_rl.init()
defer imgui_rl.shutdown()
imgui_rl.build_font_atlas()
// gameplay setup
gameplay_reset()
// game loop
for !rl.WindowShouldClose() {
imgui_rl.process_events()
imgui_rl.new_frame()
imgui.NewFrame()
input()
gameplay()
draw()
free_all(context.temp_allocator)
}
}