diff options
Diffstat (limited to 'src/camera.rs')
| -rw-r--r-- | src/camera.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/camera.rs b/src/camera.rs index 0b69833..d14adbd 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -20,6 +20,14 @@ impl Camera { (1.0 / half_w, -1.0 / half_h) } + // xl, xu, yl, yu + pub fn viewport_bounds_world(&self) -> (f32, f32, f32, f32) { + let (xl, yl) = self.screen_position_to_world(0.0, 0.0); + let (xu, yu) = + self.screen_position_to_world(self.screen_size.0 as f32, self.screen_size.1 as f32); + (xl, xu, yl, yu) + } + pub fn handle_camera_input(&mut self, input: &Input, delta_time: f32) { // wasd movement let x: f32 = if input.is_left_pressed { |
