mitchellhansen 4 years ago
parent 0f760878da
commit 781a7430bb

@ -10,8 +10,8 @@ use winit::event::{DeviceEvent, MouseButton, ElementState, Event, WindowEvent};
pub struct Sprite {
verts: VertexType,
position: (f32, f32),
size: (f32, f32),
pub position: (f32, f32),
pub size: (f32, f32),
depth: f32,
texture_handle: Arc<CanvasTextureHandle>,
}

@ -236,7 +236,11 @@ pub fn main() {
});
let mut canvas_frame = CanvasFrame::default();
canvas_frame.draw(&funky_sprite);
canvas_frame.draw(&compu_sprite1);
canvas_frame.draw(&slider);
// Events loop is borrowed from the surface
events_loop.run(move |event, _, control_flow| {
@ -263,11 +267,10 @@ pub fn main() {
Event::UserEvent(TrEvent::GamepadEvent { gil_event }) => {}
Event::DeviceEvent { event: DeviceEvent::Key(keyboard_input), .. } => {
match keyboard_input.virtual_keycode.unwrap() {
VirtualKeyCode::A => {
if keyboard_input.state == ElementState::Pressed {
// processor.save_edges_image();
funky_sprite.position.0 += 0.1;
}
}
VirtualKeyCode::P => {
@ -282,24 +285,7 @@ pub fn main() {
Event::MainEventsCleared => {
// while let true = processor.is_open() {
//
// // Take care of our timing
// {
// elapsed_time = timer.elap_time();
// delta_time = elapsed_time - current_time;
// current_time = elapsed_time;
// if delta_time > 0.02 {
// delta_time = 0.02;
// }
// accumulator_time += delta_time;
// }
//
// while (accumulator_time - step_size) >= step_size {
// accumulator_time -= step_size;
// }
canvas_frame = CanvasFrame::default();
canvas_frame.draw(&funky_sprite);
canvas_frame.draw(&compu_sprite1);
canvas_frame.draw(&slider);
@ -355,9 +341,22 @@ pub fn click_test(event_loop_proxy: EventLoopProxy<TrEvent>, canvas_state: &Canv
// while let true = processor.is_open() {
//
// // Take care of our timing
// {
// elapsed_time = timer.elap_time();
// delta_time = elapsed_time - current_time;
// current_time = elapsed_time;
// if delta_time > 0.02 {
// delta_time = 0.02;
// }
// accumulator_time += delta_time;
// }
//
// while (accumulator_time - step_size) >= step_size {
// accumulator_time -= step_size;
// }

Loading…
Cancel
Save