commit de36d1501f23109725f8d9fe9f8bc86b6587dd55 Author: Nefrace Date: Wed Sep 4 22:43:27 2024 +0300 Initial commit, basic types diff --git a/game.odin b/game.odin new file mode 100644 index 0000000..f811c51 --- /dev/null +++ b/game.odin @@ -0,0 +1,50 @@ +package main + +import rl "vendor:raylib" + + +Pad :: struct { + position: Vec2, + width: Vec2, +} + +Ball :: struct { + position: Vec2, + velocity: Vec2, + radius: f32, +} + +Brick :: struct { + position: Vec2, + size: Vec2, + color: rl.Color, + hits: u8, +} + + +Game :: struct { + using state: GameState, + lives: u8, + pad: Pad, + balls: [dynamic]Ball, + bricks: [dynamic]Brick, +} + + +game_init :: proc() -> Game { + return Game{ + update = game_update, + draw = game_draw, + lives = 3, + pad = Pad{ + position = {f32(WINDOW_WIDTH / 2), f32(WINDOW_HEIGHT - 40)} + } + } +} + +game_update :: proc(delta: f32) { + +} + +game_draw :: proc() { +} diff --git a/main.odin b/main.odin new file mode 100644 index 0000000..9456e79 --- /dev/null +++ b/main.odin @@ -0,0 +1,13 @@ +package main + +import rl "vendor:raylib" + +Vec2 :: [2]f32 +Vec2i :: [2]i32 + +WINDOW_WIDTH : i32 +WINDOW_HEIGHT : i32 + +main :: proc() { + +} diff --git a/menu.odin b/menu.odin new file mode 100644 index 0000000..53952df --- /dev/null +++ b/menu.odin @@ -0,0 +1,8 @@ +package main + +import rl "vendor:raylib" + + +Menu :: struct { + using state: GameState, +} diff --git a/state.odin b/state.odin new file mode 100644 index 0000000..e5cccc5 --- /dev/null +++ b/state.odin @@ -0,0 +1,15 @@ +package main + + +GameState :: struct { + update: proc(f32), + draw: proc(), + + variant: union{^Game, ^Menu} +} + +new_state :: proc($T: typeid) -> ^T { + state := new(T) + state.variant = state + return state +}