equal
deleted
inserted
replaced
2 |
2 |
3 #[derive(Debug)] |
3 #[derive(Debug)] |
4 pub struct Camera { |
4 pub struct Camera { |
5 pub position: Point, |
5 pub position: Point, |
6 pub zoom: f32, |
6 pub zoom: f32, |
7 size: Size |
7 size: Size, |
8 } |
8 } |
9 |
9 |
10 impl Camera { |
10 impl Camera { |
11 pub fn new() -> Self { |
11 pub fn new() -> Self { |
12 Self {position: Point::ZERO, zoom: 0.0, size: Size::new(1024, 768) } |
12 Self::with_size(Size::new(1024, 768)) |
|
13 } |
|
14 |
|
15 pub fn with_size(size: Size) -> Self { |
|
16 Self { |
|
17 position: Point::ZERO, |
|
18 zoom: 0.0, |
|
19 size, |
|
20 } |
13 } |
21 } |
14 |
22 |
15 pub fn viewport(&self) -> Rect { |
23 pub fn viewport(&self) -> Rect { |
16 Rect::from_size(self.position, self.size) |
24 Rect::from_size(self.position, self.size) |
17 } |
25 } |