Expand description
Camera system — viewport positioning with smooth follow, zoom, and boundary clamping.
A general-purpose camera that supports arbitrary world sizes, fractional pixel positions, smooth interpolation, and zoom. It supersedes the older fixed Game Boy-style scroll/viewport approach.
§Usage
ⓘ
use dotzuki_engine::camera::{Camera, Vec2, Rect};
let mut cam = Camera::new(160.0, 144.0);
cam.clamp_to_bounds(Rect::new(0.0, 0.0, 2048.0, 2048.0));
cam.follow_target(Vec2::new(player_x, player_y));
// Every frame:
cam.update(dt);
let screen_pos = cam.world_to_screen(Vec2::new(npc_x, npc_y));