aboutsummaryrefslogtreecommitdiff
path: root/src/main.odin
diff options
context:
space:
mode:
authorXander Swan <no email>2025-12-05 09:27:12 -0500
committerXander Swan <no email>2025-12-05 09:27:12 -0500
commit3375d712e40cce1d17198ba20839f58a2a77d202 (patch)
tree856f517c9e9e59173b81b62a40bd4d2f1115d378 /src/main.odin
parent53cba1d004451f0782312cb203afb7da47a29c5f (diff)
add platforms and AABB collision
Diffstat (limited to 'src/main.odin')
-rw-r--r--src/main.odin31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main.odin b/src/main.odin
index 95ddbcd..9a9c91c 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -18,9 +18,16 @@ import "draw"
Vec2 :: [2]f32
+Rect :: struct {
+ start: Vec2,
+ size: Vec2,
+}
+
state: struct {
player: Player,
+ platform_list: Entity_List(Platform),
+
renderer: draw.Renderer,
input: Input,
@@ -49,6 +56,26 @@ init :: proc "c" () {
draw.init(&state.renderer)
init_player(&state.player)
+
+ make_platform(Rect{
+ start = {50, 50},
+ size = {100, 20}
+ })
+
+ make_platform(Rect{
+ start = {20, 340},
+ size = {440, 20}
+ })
+
+ make_platform(Rect{
+ start = {140, 320},
+ size = {20, 20}
+ })
+
+ make_platform(Rect{
+ start = {240, 280},
+ size = {20, 20}
+ })
}
frame :: proc "c" () {
@@ -60,6 +87,8 @@ frame :: proc "c" () {
draw_player(state.player)
+ draw_platforms()
+
draw.end_frame(&state.renderer)
free_all(context.temp_allocator)
@@ -78,6 +107,8 @@ event :: proc "c" (event: ^sapp.Event) {
cleanup :: proc "c" () {
context = default_context()
sg.shutdown()
+
+ delete_entity_list(state.platform_list)
}
main :: proc() {