summaryrefslogtreecommitdiff
path: root/src/camera.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/camera.rs')
-rw-r--r--src/camera.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/camera.rs b/src/camera.rs
index 13c5ec9..0fe9f22 100644
--- a/src/camera.rs
+++ b/src/camera.rs
@@ -1,4 +1,7 @@
-use crate::{Input, config::CAMERA_MOVEMENT_SPEED};
+use crate::{
+ config::CAMERA_MOVEMENT_SPEED,
+ input::{Input, InputManager},
+};
#[repr(C)]
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)]
@@ -28,18 +31,18 @@ impl Camera {
(xl, xu, yl, yu)
}
- pub fn handle_camera_input(&mut self, input: &Input, delta_time: f32) {
+ pub fn handle_camera_input(&mut self, input_manager: &InputManager, delta_time: f32) {
// wasd movement
- let x: f32 = if input.is_left_pressed {
+ let x: f32 = if input_manager.held(Input::Left) {
-1.0
- } else if input.is_right_pressed {
+ } else if input_manager.held(Input::Right) {
1.0
} else {
0.0
};
- let y: f32 = if input.is_down_pressed {
+ let y: f32 = if input_manager.held(Input::Down) {
1.0
- } else if input.is_up_pressed {
+ } else if input_manager.held(Input::Up) {
-1.0
} else {
0.0