aboutsummaryrefslogtreecommitdiff
path: root/src/main.odin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.odin')
-rw-r--r--src/main.odin22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/main.odin b/src/main.odin
index 1e3f8ba..969c25b 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -21,6 +21,7 @@ Rect :: struct {
}
state: struct {
+ debug_mode: bool,
camera: rl.Camera2D,
platform_list: Entity_List(Platform),
bullet_list: Entity_List(Bullet),
@@ -65,6 +66,10 @@ init :: proc() {
}
frame :: proc() {
+ if is_keybind_just_down(actions.toggle_debug_mode) {
+ state.debug_mode = !state.debug_mode
+ }
+
update_player(rl.GetFrameTime())
update_bullets(rl.GetFrameTime())
@@ -75,7 +80,18 @@ frame :: proc() {
draw_player()
draw_room(current_room.id)
draw_bullets()
- // draw_platforms()
+
+ if state.debug_mode {
+ // Draw all collisions
+ body_it: int
+ renderer.tint = {1, 0.25, 0.5, 0.5}
+ for body in phys.iterate_bodies(&body_it) {
+ rect := phys.get_rect(body)
+ rect.start += phys.get_position(body)
+ draw_linerect(transmute(Rect)rect)
+ }
+ renderer.tint = {1, 1, 1, 1}
+ }
rl.EndMode2D()
@@ -86,6 +102,10 @@ frame :: proc() {
)
rl.DrawText(fps_text, 5, 5, 8, rl.GREEN)
+ if state.debug_mode {
+ rl.DrawText("Debug Mode", 5, 5 + 8, 8, rl.YELLOW)
+ }
+
draw_end_frame()
}