Cleaned up debug and make camera dragable.

This commit is contained in:
2026-07-24 08:23:49 +02:00
parent 101ef99218
commit efc260758b
+9 -14
View File
@@ -1,6 +1,5 @@
package game
import "core:fmt"
import rl "vendor:raylib"
Debug :: struct {
@@ -26,13 +25,11 @@ debug_fps :: proc() {
for i in i32(0)..<4 {
if rl.IsGamepadAvailable(i) {
rl.DrawText(rl.TextFormat("GP%d: %s", i, rl.GetGamepadName(i)), 20, 45 + i*20, 20, rl.BLACK)
} else {
rl.DrawText(rl.TextFormat("GP%d: NOT DETECTED", i), 20, 45 + i*20, 20, rl.GRAY)
}
}
}
}
}
// DEBUG CAMERA
debug_camera_init :: proc(player: Player) -> rl.Camera2D {
@@ -52,26 +49,24 @@ debug_camera_init :: proc(player: Player) -> rl.Camera2D {
debug_camera_update :: proc(debug: ^Debug) {
when DEBUG_MODE {
if rl.IsKeyPressed(.ONE) {
debug.camera_active = !debug.camera_active
}
if rl.IsKeyPressed(.TWO) {
debug.bounds_active = !debug.bounds_active
}
if rl.IsKeyDown(.LEFT_CONTROL) {
scroll := rl.GetMouseWheelMove()
if scroll != 0.0 {
debug.camera.zoom += scroll * 0.1
}
}
if rl.IsMouseButtonDown(.RIGHT) {
sensitivity: f32 = 0.32
mouse_move := rl.GetMouseDelta()
debug.camera.target -= ((mouse_move * sensitivity) / debug.camera.zoom)
}
if rl.IsKeyPressed(.ONE) {
debug.camera_active = !debug.camera_active
}
if rl.IsKeyPressed(.TWO) {
debug.bounds_active = !debug.bounds_active
}
}
}