Cleaned up debug and make camera dragable.
This commit is contained in:
+9
-14
@@ -1,6 +1,5 @@
|
||||
package game
|
||||
|
||||
import "core:fmt"
|
||||
import rl "vendor:raylib"
|
||||
|
||||
Debug :: struct {
|
||||
@@ -26,12 +25,10 @@ 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
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user