From 80a8f73d9c668f0f54646ff2723ff7650e5d37a8 Mon Sep 17 00:00:00 2001 From: mitchellhansen Date: Sat, 8 Aug 2020 16:00:13 -0700 Subject: [PATCH] . --- src/drawables/slider.rs | 8 ++++---- src/main.rs | 14 ++++++++++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/drawables/slider.rs b/src/drawables/slider.rs index a7091900..d4416c03 100644 --- a/src/drawables/slider.rs +++ b/src/drawables/slider.rs @@ -26,12 +26,12 @@ impl Slider { let blue = (0.0, 1.0, 1.0, 0.0); let rg = (1.0, 1.0, 0.0, 0.0); - let left_guide_bar = Rect::new((position.0, position.1), (0.01, size.1), 1, red); - let right_guide_bar = Rect::new((position.0 + size.0, position.1), (0.01, size.1), 1, blue); - let line = Rect::new((position.0, position.1 - (size.1 / 2.0) ), (size.0, 0.01), 1, green); + let left_guide_bar = Rect::new((position.0, position.1), (2.0, size.1), 1, red); + let right_guide_bar = Rect::new((position.0 + size.0, position.1), (2.0, size.1), 1, blue); + let line = Rect::new((position.0, position.1 - (size.1 / 2.0) ), (size.0, 2.0), 1, green); let scale = value as f32 / u16::max_value() as f32; - let handle = Rect::new((position.0 + (size.0 * scale), position.1), (0.03, size.1), 1, rg); + let handle = Rect::new((position.0 + (size.0 * scale), position.1), (15.0, size.1), 1, rg); Slider { handle: handle, diff --git a/src/main.rs b/src/main.rs index 1a390551..e3a55b6a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -174,7 +174,10 @@ pub fn main() { let mut canvas_frame = CanvasFrame::new(window_size); let mut compu_frame = CompuFrame::new(window_size); - let mut container = Box::new(Slider::new((0.1, 0.1), (0.9, 0.9), 5000)); + let mut big_container = vec![ + Box::new(Slider::new((0.1, 0.1), (0.9, 0.9), 5000)), + Box::new(Sprite::new((0.0, -0.5), (0.5, 0.5), 1, sfml_handle.clone())), + ]; //container.push(Sprite::new((0.1))); @@ -182,7 +185,13 @@ pub fn main() { events_loop.run(move |event, _, control_flow| { *control_flow = ControlFlow::Poll; - funky_sprite.notify(&event); + for eventable in &mut big_container { + eventable.notify(&event); + } + + for drawable in &mut big_container { + canvas_frame.draw(&drawable); + } match event { Event::NewEvents(cause) => { @@ -244,6 +253,7 @@ pub fn main() { canvas_frame = CanvasFrame::new(window_size); canvas_frame.draw(&funky_sprite); + //canvas_frame.draw(&container); // canvas_frame.draw(&compu_sprite1); canvas_frame.draw(&slider);