Working on zooming and scrolling of the image. Want to do a full input chain like I did the raycaster, but I don't know if I want to commit to SFML for my windowing...

This commit is contained in:
2019-07-06 20:24:15 -07:00
parent 5551581a3e
commit a403d13f41
2 changed files with 35 additions and 14 deletions

View File

@@ -92,21 +92,30 @@ fn main() {
if code == Key::Escape {
return;
}
}
},
Event::MouseButtonPressed { button, x, y } => {
if button == Button::Left {
return;
},
Event::MouseWheelScrolled { wheel, delta, x, y } => {
if delta > 0.0 {
println!("{:?}", delta);
println!("{:?}", background_sprite.get_scale());
background_sprite.set_scale(background_sprite.get_scale()+Vector2f::new(0.1,0.1));
} else {
println!("{:?}", delta);
println!("{:?}", background_sprite.get_scale()+Vector2f::new(-0.1,-0.1));
background_sprite.set_scale(background_sprite.get_scale()+Vector2f::new(-0.1,-0.1));
}
}
},
_ => {}
}
input.ingest(&event)
}
if input.is_held(Key::W) {}
if input.is_held(Key::A) {}
if input.is_held(Key::S) {}
if input.is_held(Key::D) {}
if input.is_mousebutton_held(Button::Left) {
}
elapsed_time = timer.elap_time();
delta_time = elapsed_time - current_time;