53 lines
932 B
Odin
53 lines
932 B
Odin
package main
|
|
|
|
import rl "vendor:raylib"
|
|
import "core:slice"
|
|
|
|
Vec2 :: [2]f32
|
|
Vec2i :: [2]i32
|
|
|
|
WINDOW_WIDTH : i32 = 800
|
|
WINDOW_HEIGHT : i32 = 480
|
|
|
|
|
|
main :: proc() {
|
|
rl.SetConfigFlags(rl.ConfigFlags{.BORDERLESS_WINDOWED_MODE, .VSYNC_HINT, .WINDOW_RESIZABLE})
|
|
monitor := rl.GetCurrentMonitor()
|
|
WINDOW_WIDTH = rl.GetMonitorWidth(monitor)
|
|
WINDOW_HEIGHT = rl.GetMonitorHeight(monitor)
|
|
rl.InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "SinePong")
|
|
rl.SetTargetFPS(9999)
|
|
|
|
stack_init()
|
|
|
|
defer {
|
|
for s, i in state_stack {
|
|
free(s)
|
|
}
|
|
}
|
|
|
|
game := game_init()
|
|
append(&state_stack, game)
|
|
|
|
for (!rl.WindowShouldClose()) {
|
|
if rl.IsWindowResized() {
|
|
WINDOW_WIDTH = rl.GetScreenWidth()
|
|
WINDOW_HEIGHT = rl.GetScreenHeight()
|
|
}
|
|
|
|
current_state := state_stack[len(state_stack)-1]
|
|
|
|
delta := rl.GetFrameTime()
|
|
|
|
current_state->update(delta)
|
|
|
|
{
|
|
rl.BeginDrawing()
|
|
defer rl.EndDrawing()
|
|
current_state->draw()
|
|
}
|
|
|
|
}
|
|
|
|
}
|