59 lines
		
	
	
		
			936 B
		
	
	
	
		
			Odin
		
	
	
	
	
	
			
		
		
	
	
			59 lines
		
	
	
		
			936 B
		
	
	
	
		
			Odin
		
	
	
	
	
	
package topdown
 | 
						|
 | 
						|
import rl "vendor:raylib"
 | 
						|
import "core:math"
 | 
						|
import "core:math/rand"
 | 
						|
import "core:fmt"
 | 
						|
 | 
						|
Vec2 :: [2]f32
 | 
						|
Rect :: rl.Rectangle
 | 
						|
 | 
						|
SCREEN_WIDTH : i32 = 1000
 | 
						|
SCREEN_HEIGHT : i32 = 800
 | 
						|
BW := f32(SCREEN_WIDTH)
 | 
						|
BH := f32(SCREEN_HEIGHT)
 | 
						|
 | 
						|
GameState :: struct {
 | 
						|
    dt: f32,
 | 
						|
} 
 | 
						|
 | 
						|
init_state :: proc() -> ^GameState {
 | 
						|
    state := GameState {}
 | 
						|
    return new_clone(state)
 | 
						|
}
 | 
						|
 | 
						|
player_input :: proc(s: ^GameState) {
 | 
						|
}
 | 
						|
 | 
						|
update :: proc(s: ^GameState) {
 | 
						|
}
 | 
						|
 | 
						|
draw2d :: proc(s: ^GameState) {
 | 
						|
}
 | 
						|
 | 
						|
main :: proc() {
 | 
						|
    rl.SetTraceLogLevel(.ERROR)
 | 
						|
    rl.InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Asteroids")
 | 
						|
    rl.SetTargetFPS(60)
 | 
						|
 | 
						|
    state := init_state()
 | 
						|
    defer free(state)
 | 
						|
 | 
						|
    for !rl.WindowShouldClose() {
 | 
						|
        state.dt = rl.GetFrameTime()
 | 
						|
 | 
						|
        player_input(state)
 | 
						|
 | 
						|
        update(state)
 | 
						|
 | 
						|
        rl.BeginDrawing()
 | 
						|
        rl.ClearBackground(rl.BLACK)
 | 
						|
 | 
						|
        draw2d(state)
 | 
						|
 | 
						|
        rl.EndDrawing()
 | 
						|
    }
 | 
						|
 | 
						|
    rl.CloseWindow()
 | 
						|
}
 |