Galactica/crates/playeragent/src/camera.rs

25 lines
389 B
Rust
Raw Normal View History

2024-01-12 22:47:40 -08:00
use nalgebra::Vector2;
2023-12-25 11:17:08 -08:00
#[derive(Debug, Clone, Copy)]
pub struct Camera {
/// Camera center
2024-01-12 22:47:40 -08:00
pub pos: Vector2<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 {
2024-01-12 22:47:40 -08:00
pos: Vector2::new(0.0, 0.0),
2024-01-11 11:28:51 -08:00
zoom: 500.0,
aspect: 1.0,
}
}
}