This commit is contained in:
Hanno Braun 2024-11-15 18:24:28 +01:00
parent 04bd789006
commit 8065543d8e
3 changed files with 17 additions and 26 deletions

View File

@ -7,14 +7,6 @@ use crate::{
use super::InputEvent; use super::InputEvent;
/// Input handling abstraction
///
/// Takes user input and applies them to application state.
#[derive(Default)]
pub struct InputHandler;
impl InputHandler {
/// Handle an input event
pub fn handle_event( pub fn handle_event(
event: InputEvent, event: InputEvent,
focus_point: FocusPoint, focus_point: FocusPoint,
@ -32,7 +24,6 @@ impl InputHandler {
} }
} }
} }
}
pub fn apply_translation( pub fn apply_translation(
previous: NormalizedScreenPosition, previous: NormalizedScreenPosition,

View File

@ -3,4 +3,4 @@
mod event; mod event;
mod handler; mod handler;
pub use self::{event::InputEvent, handler::InputHandler}; pub use self::{event::InputEvent, handler::handle_event};

View File

@ -4,7 +4,7 @@ use tracing::warn;
use crate::{ use crate::{
camera::{Camera, FocusPoint}, camera::{Camera, FocusPoint},
graphics::{DrawConfig, Renderer}, graphics::{DrawConfig, Renderer},
input::InputHandler, input::handle_event,
InputEvent, NormalizedScreenPosition, RendererInitError, Screen, InputEvent, NormalizedScreenPosition, RendererInitError, Screen,
ScreenSize, ScreenSize,
}; };
@ -62,7 +62,7 @@ impl Viewer {
/// Handle an input event /// Handle an input event
pub fn handle_input_event(&mut self, event: InputEvent) { pub fn handle_input_event(&mut self, event: InputEvent) {
if let Some(focus_point) = self.focus_point { if let Some(focus_point) = self.focus_point {
InputHandler::handle_event(event, focus_point, &mut self.camera); handle_event(event, focus_point, &mut self.camera);
} }
} }