struct Color {
	r g b a: u8,
}

fn ClearBackground(c: u32)
fn DrawRectangle(x y w h: i32, c: u32)
fn DrawCircle(x y: i32, r: f32, c: u32)

fn InitWindow(w h: i32, title: i32)
fn CloseWindow
fn BeginDrawing
fn SetTargetFPS(fps: i32)
fn EndDrawing
fn DrawFPS(x y: i32)
fn WindowShouldClose i32

fn ColorToRaylib(c: Color) u32 {
	ret c.a as u32 << 24 as u32 | c.b as u32 << 16 as u32 | c.g as u32 << 8 as u32 | c.r
}

fn ClearBackgroundWrap(c: Color) {
	ClearBackground (ColorToRaylib c)
}

fn DrawRectangleWrap(x y w h: i32, c: Color) {
	DrawRectangle x y w h (ColorToRaylib c)
}

fn DrawCircleWrap(x y: i32, r: f32, c: Color) {
	DrawCircle x y r (ColorToRaylib c)
	ret
}

let white :: .Color{69 69 69 255}
let red :: .Color{255 0 0 255}
let blue :: .Color{0 0 255 255}

let x := 0
let dir := 1

fn GetScreenHeight i32

InitWindow 640 480 0
SetTargetFPS 60
for WindowShouldClose == 0 {
	x = x + dir
	if x > GetScreenHeight - 200 {
		dir = -1
	} elif x < 0 {
		dir = 1
	}

	BeginDrawing
	ClearBackgroundWrap white
	DrawFPS 20 20
	DrawRectangleWrap 80 x 100 200 red
	DrawCircleWrap 200 200 100.0 blue
	EndDrawing
}
CloseWindow

