#pragma once // camera_2d — pure orthographic 2D camera (issue 0072b). // No state, no I/O. World <-> screen transforms + ortho view-projection matrix. #include "../core/math2d.h" namespace fn::cam { struct Camera2D { fn::math2d::Vec2 pos = {0.0f, 0.0f}; // world position of camera center float zoom = 1.0f; // 1 = no zoom; >1 zoom in float rotation = 0.0f; // radians int viewport_w = 1280; int viewport_h = 720; }; fn::math2d::Vec2 world_to_screen(const Camera2D& c, fn::math2d::Vec2 world); fn::math2d::Vec2 screen_to_world(const Camera2D& c, fn::math2d::Vec2 screen); fn::math2d::Rect visible_world_rect(const Camera2D& c); // Column-major 4x4 view-projection matrix (orthographic). void view_proj_matrix(const Camera2D& c, float out[16]); } // namespace fn::cam