Galactica/crates/playeragent/src/camera.rs

25 lines
380 B
Rust
Raw Normal View History

2023-12-25 11:17:08 -08:00
use cgmath::Point2;
#[derive(Debug, Clone, Copy)]
pub struct Camera {
/// Camera center
2023-12-25 16:22:44 -08:00
pub pos: Point2<f32>,
2023-12-25 11:17:08 -08:00
/// Camera zoom
/// (How many game units tall is the viewport?)
2023-12-25 16:22:44 -08:00
pub zoom: f32,
2024-01-01 22:25:16 -08:00
/// Aspect ratio of viewport (width / height)
pub aspect: f32,
2023-12-25 11:17:08 -08:00
}
2024-01-11 11:28:51 -08:00
impl Camera {
pub fn new() -> Self {
Self {
pos: (0.0, 0.0).into(),
zoom: 500.0,
aspect: 1.0,
}
}
}