package main

import rl "libraries/raylib"
import "base:runtime"

WINDOW_WIDTH :: 1280
WINDOW_HEIGHT :: 720
WINDOW_FRAMERATE :: 30
WINDOW_CAPTION :: "Transformation Visualizer"

init :: proc() {
	rl.SetTraceLogLevel(.WARNING)
	rl.SetConfigFlags({.VSYNC_HINT})
	rl.InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_CAPTION)
	rl.SetTargetFPS(WINDOW_FRAMERATE)
	program_init()
}

update :: proc() {
	rl.BeginDrawing()
	defer rl.EndDrawing()
	rl.ClearBackground(rl.BLACK)
	program_update()
	free_all(context.temp_allocator)
}

parent_window_size_changed :: proc(w, h: int) {
	rl.SetWindowSize(i32(w), i32(h))
}

shutdown :: proc() {
	rl.CloseWindow()
}

should_run :: proc() -> bool {
	when ODIN_OS != .JS {
		if rl.WindowShouldClose() {
			return false
		}
	}
	return true
}
