25 lines
389 B
Rust
25 lines
389 B
Rust
use nalgebra::Vector2;
|
|
|
|
#[derive(Debug, Clone, Copy)]
|
|
pub struct Camera {
|
|
/// Camera center
|
|
pub pos: Vector2<f32>,
|
|
|
|
/// Camera zoom
|
|
/// (How many game units tall is the viewport?)
|
|
pub zoom: f32,
|
|
|
|
/// Aspect ratio of viewport (width / height)
|
|
pub aspect: f32,
|
|
}
|
|
|
|
impl Camera {
|
|
pub fn new() -> Self {
|
|
Self {
|
|
pos: Vector2::new(0.0, 0.0),
|
|
zoom: 500.0,
|
|
aspect: 1.0,
|
|
}
|
|
}
|
|
}
|