25 lines
380 B
Rust
25 lines
380 B
Rust
|
use cgmath::Point2;
|
||
|
|
||
|
#[derive(Debug, Clone, Copy)]
|
||
|
pub struct Camera {
|
||
|
/// Camera center
|
||
|
pub pos: Point2<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: (0.0, 0.0).into(),
|
||
|
zoom: 500.0,
|
||
|
aspect: 1.0,
|
||
|
}
|
||
|
}
|
||
|
}
|