|
|
@ -15,7 +15,9 @@ use sfml::graphics::{
|
|
|
|
};
|
|
|
|
};
|
|
|
|
use sfml::system::*;
|
|
|
|
use sfml::system::*;
|
|
|
|
use sfml::window::{Event, Key, Style};
|
|
|
|
use sfml::window::{Event, Key, Style};
|
|
|
|
use sfml::window::mouse::Button;
|
|
|
|
use sfml::window::mouse::*;
|
|
|
|
|
|
|
|
use sfml::window::mouse;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use vulkano::sync;
|
|
|
|
use vulkano::sync;
|
|
|
|
use std::sync::Arc;
|
|
|
|
use std::sync::Arc;
|
|
|
@ -84,7 +86,10 @@ fn main() {
|
|
|
|
let mut accumulator_time: f32 = 0.0;
|
|
|
|
let mut accumulator_time: f32 = 0.0;
|
|
|
|
let mut current_time: f32 = timer.elap_time();
|
|
|
|
let mut current_time: f32 = timer.elap_time();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mut mouse_xy = Vector2i::new(0,0);
|
|
|
|
|
|
|
|
|
|
|
|
while window.is_open() {
|
|
|
|
while window.is_open() {
|
|
|
|
|
|
|
|
|
|
|
|
while let Some(event) = window.poll_event() {
|
|
|
|
while let Some(event) = window.poll_event() {
|
|
|
|
match event {
|
|
|
|
match event {
|
|
|
|
Event::Closed => return,
|
|
|
|
Event::Closed => return,
|
|
|
@ -94,18 +99,13 @@ fn main() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Event::MouseButtonPressed { button, x, y } => {
|
|
|
|
Event::MouseButtonPressed { button, x, y } => {
|
|
|
|
|
|
|
|
mouse_xy = mouse::desktop_position();
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Event::MouseWheelScrolled { wheel, delta, x, y } => {
|
|
|
|
Event::MouseWheelScrolled { wheel, delta, x, y } => {
|
|
|
|
|
|
|
|
|
|
|
|
if delta > 0.0 {
|
|
|
|
if delta > 0.0 {
|
|
|
|
println!("{:?}", delta);
|
|
|
|
background_sprite.set_scale(background_sprite.get_scale()*Vector2f::new(1.1,1.1));
|
|
|
|
println!("{:?}", background_sprite.get_scale());
|
|
|
|
|
|
|
|
background_sprite.set_scale(background_sprite.get_scale()+Vector2f::new(0.1,0.1));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
println!("{:?}", delta);
|
|
|
|
background_sprite.set_scale(background_sprite.get_scale()*Vector2f::new(0.9,0.9));
|
|
|
|
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));
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
_ => {}
|
|
|
|
_ => {}
|
|
|
@ -115,6 +115,13 @@ fn main() {
|
|
|
|
|
|
|
|
|
|
|
|
if input.is_mousebutton_held(Button::Left) {
|
|
|
|
if input.is_mousebutton_held(Button::Left) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let delta = mouse_xy - mouse::desktop_position();
|
|
|
|
|
|
|
|
mouse_xy = mouse::desktop_position();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
println!("{:?}", delta);
|
|
|
|
|
|
|
|
background_sprite.set_position(
|
|
|
|
|
|
|
|
background_sprite.position() - Vector2f::new(delta.x as f32, delta.y as f32)
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
elapsed_time = timer.elap_time();
|
|
|
|
elapsed_time = timer.elap_time();
|
|
|
|