diff options
author | Tom Barrett <tom@tombarrett.xyz> | 2022-02-02 19:08:44 +0100 |
---|---|---|
committer | Tom Barrett <tom@tombarrett.xyz> | 2022-02-02 19:08:44 +0100 |
commit | ceb3eff116f9ddf8dcb71a0a77efb63531f75ab2 (patch) | |
tree | c818ad7241797fa72e0cb802f09c9a1b296e1fb0 /src/camera.rs | |
parent | 8cdbe7352c4846eb339358bcca6083f747e27721 (diff) |
Diffstat (limited to 'src/camera.rs')
-rw-r--r-- | src/camera.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/camera.rs b/src/camera.rs index bcb8f69..3461df1 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -1,10 +1,10 @@ use ggez::conf::Conf; -use ggez::nalgebra::Point2; +use glam::*; use crate::constants; pub struct Camera { - pub draw: Point2<f32>, + pub draw: glam::Vec2, window_dimensions: (f32, f32), map_dimensions: (f32, f32), } @@ -13,13 +13,13 @@ impl Camera { pub fn new(map_dimensions: (f32, f32)) -> Camera { let conf = Conf::new(); Camera { - draw: Point2::new(0.0, 0.0), + draw: glam::Vec2::new(0.0, 0.0), window_dimensions: (conf.window_mode.width, conf.window_mode.height), map_dimensions, } } - pub fn give_center(&mut self, center: Point2<f32>) { + pub fn give_center(&mut self, center: glam::Vec2) { self.draw.x = ((self.window_dimensions.0 / 2.0) - center.x) - (constants::TILE_WIDTH); self.draw.y = ((self.window_dimensions.1 / 2.0) - center.y) - (constants::TILE_HEIGHT); |