Fix input offsets

This commit is contained in:
Kenny Levinsen
2019-07-31 17:37:15 +02:00
parent 247a56edf5
commit a293b5914a
2 changed files with 14 additions and 6 deletions
+9
View File
@@ -10,6 +10,15 @@ pub enum Input {
Scroll { pos: (u32, u32), x: f64, y: f64 },
}
impl Input {
pub fn offset(&self, offset: (u32, u32)) -> Input{
match self {
Input::Click{pos, button} => Input::Click{pos: (pos.0 - offset.0, pos.1 - offset.1), button: *button},
Input::Scroll{pos, x, y} => Input::Scroll{pos: (pos.0 - offset.0, pos.1 - offset.1), x: *x, y: *y},
}
}
}
pub trait ModuleImpl {
fn draw(
&self,