diff --git a/src/drawables/sprite.rs b/src/drawables/sprite.rs index 25bb1b75..aee21d31 100644 --- a/src/drawables/sprite.rs +++ b/src/drawables/sprite.rs @@ -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, } diff --git a/src/main.rs b/src/main.rs index de72609a..ee053768 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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, 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; +// }