diff --git a/src/debug.odin b/src/debug.odin new file mode 100644 index 0000000..fd2ac07 --- /dev/null +++ b/src/debug.odin @@ -0,0 +1,34 @@ +package game + +import rl "vendor:raylib" + +debug_init :: proc() { + rl.TraceLog(.INFO, "Game initialized") +} + +debug_fps :: proc() { + if !DEBUG_MODE do return + rl.DrawFPS(20, 20) +} + +// DEBUG CAMERA +debug_camera_init :: proc(player: Player) -> rl.Camera2D { + offset_adjust := (TILE_SIZE / 2) * 0.3 + + return rl.Camera2D { + target = player.pos, + offset = rl.Vector2{ f32(GAME_WIDTH/2 - offset_adjust), f32(GAME_HEIGHT/2 - offset_adjust) }, + rotation = 0, + zoom = 0.3 + } +} + +update_debug_camera :: proc(camera: ^rl.Camera2D) { + if rl.IsKeyDown(.LEFT_CONTROL) { + scroll := rl.GetMouseWheelMove() + if scroll != 0.0 { + camera.zoom += scroll * 0.1 + } + } +} +