aboutsummaryrefslogtreecommitdiff
path: root/src/main.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.odin')
-rw-r--r--src/main.odin55
1 files changed, 14 insertions, 41 deletions
diff --git a/src/main.odin b/src/main.odin
index 88bf953..2e02f3c 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -43,48 +43,19 @@ init :: proc() {
}
state.room = room
- make_platform(Rect{
- start = {50, 50},
- size = {64, 20}
- })
-
- i := f32(20)
- for i < draw.SCREEN_WIDTH - 20 - 64 {
- make_platform(Rect{
- start = {i, draw.SCREEN_HEIGHT - 20},
- size = {64, 20}
+ make_map_collisions :: proc(
+ x: i32,
+ y: i32,
+ tile: tiled.Tile,
+ tile_set: tiled.Tile_Set,
+ ) {
+ make_platform({
+ {f32(x), f32(y)},
+ {f32(tile_set.tile_width), f32(tile_set.tile_height)},
})
- i += 65
}
- make_platform(Rect{
- start = {160, 320},
- size = {20, 20}
- })
- make_platform(Rect{
- start = {300, 220},
- size = {40, 20}
- })
-
- make_platform(Rect{
- start = {240, 180},
- size = {40, 20}
- })
-
- make_platform(Rect{
- start = {200, 140},
- size = {40, 20}
- })
-
- make_platform(Rect{
- start = {180, 100},
- size = {20, 20}
- })
-
- make_platform(Rect{
- start = {140, 100},
- size = {16, 16}
- })
+ tiled.iterate_map_tiles(state.room, make_map_collisions)
}
frame :: proc() {
@@ -121,7 +92,10 @@ main :: proc() {
defer {
if len(track.allocation_map) > 0 {
- fmt.eprintf("=== %v allocations not freed: ===\n", len(track.allocation_map))
+ fmt.eprintf(
+ "=== %v allocations not freed: ===\n",
+ len(track.allocation_map),
+ )
total := 0
for _, entry in track.allocation_map {
fmt.eprintf(
@@ -158,4 +132,3 @@ main :: proc() {
cleanup()
}
-