Ragnarokkr/main.odin

55 lines
1.3 KiB
Odin
Raw Normal View History

2024-10-04 21:16:58 +03:00
package main
import rl "vendor:raylib"
vec3 :: [3]f32
vec2 :: [2]f32
vec3right := vec3{1, 0, 0}
vec3left := vec3{-1, 0, 0}
vec3up := vec3{0, 1, 0}
vec3down := vec3{0, -1, 0}
vec3forward := vec3{0, 0, 1}
vec3backward := vec3{0, 0, -1}
WSize := [2]f32{}
WSizei := [2]i32{}
WindowShouldExit := false
FontUI: rl.Font
FontTitle: rl.Font
main :: proc() {
rl.SetConfigFlags(rl.ConfigFlags{.MSAA_4X_HINT, .WINDOW_MAXIMIZED, .WINDOW_RESIZABLE})
rl.InitWindow(800, 480, "Ragnarøkkr")
WSizei = {rl.GetScreenWidth(), rl.GetScreenHeight()}
WSize = {f32(WSizei.x), f32(WSizei.y)}
FontUI = rl.LoadFontEx(".\\assets\\fonts\\PTSerif-Regular.ttf", 96, nil, 2048)
FontTitle = rl.LoadFontEx(".\\assets\\fonts\\norse.otf", 96*2, nil, 2048)
game := game_init()
stack_push(game)
menu := menu_init(game)
stack_push(menu)
for !WindowShouldExit {
if rl.IsWindowResized() {
WSizei = {rl.GetScreenWidth(), rl.GetScreenHeight()}
WSize = {f32(WSizei.x), f32(WSizei.y)}
}
state := stack_top()
delta := rl.GetFrameTime()
timers_process(delta)
tweens_process(delta)
state->update(delta)
rl.BeginDrawing()
rl.ClearBackground(rl.SKYBLUE)
state->draw()
rl.EndDrawing()
}
}