aboutsummaryrefslogtreecommitdiff
path: root/src/world.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/world.odin')
-rw-r--r--src/world.odin14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/world.odin b/src/world.odin
index d6f611e..eca934c 100644
--- a/src/world.odin
+++ b/src/world.odin
@@ -1,5 +1,7 @@
package demonchime
+import "core:log"
+
import rl "vendor:raylib"
Object_Spawner :: proc(Object_Resource)
@@ -40,6 +42,8 @@ _open_room :: proc(room_pos: Room_Position_Resource) {
current_room = room_pos
+ log.infof("Opened room %v", current_room.id)
+
for cb in room_open_cb {
cb(current_room.id)
}
@@ -47,6 +51,16 @@ _open_room :: proc(room_pos: Room_Position_Resource) {
_spawn_objects(current_room.id)
}
+point_inside_room :: proc(pos: Vec2) -> bool {
+ width := f32(current_room.width)
+ height := f32(current_room.height)
+
+ return pos.x >= 0 &&
+ pos.x <= width &&
+ pos.y >= 0 &&
+ pos.y <= height
+}
+
open_room_at :: proc(pos: [2]i32) -> bool {
pos := pos
pos += {current_room.x, current_room.y}