mitchellhansen 4 years ago
parent 799e337e37
commit 80a8f73d9c

@ -26,12 +26,12 @@ impl Slider {
let blue = (0.0, 1.0, 1.0, 0.0); let blue = (0.0, 1.0, 1.0, 0.0);
let rg = (1.0, 1.0, 0.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 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), (0.01, size.1), 1, blue); 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, 0.01), 1, green); 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 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 { Slider {
handle: handle, handle: handle,

@ -174,7 +174,10 @@ pub fn main() {
let mut canvas_frame = CanvasFrame::new(window_size); let mut canvas_frame = CanvasFrame::new(window_size);
let mut compu_frame = CompuFrame::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))); //container.push(Sprite::new((0.1)));
@ -182,7 +185,13 @@ pub fn main() {
events_loop.run(move |event, _, control_flow| { events_loop.run(move |event, _, control_flow| {
*control_flow = ControlFlow::Poll; *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 { match event {
Event::NewEvents(cause) => { Event::NewEvents(cause) => {
@ -244,6 +253,7 @@ pub fn main() {
canvas_frame = CanvasFrame::new(window_size); canvas_frame = CanvasFrame::new(window_size);
canvas_frame.draw(&funky_sprite); canvas_frame.draw(&funky_sprite);
//canvas_frame.draw(&container);
// canvas_frame.draw(&compu_sprite1); // canvas_frame.draw(&compu_sprite1);
canvas_frame.draw(&slider); canvas_frame.draw(&slider);

Loading…
Cancel
Save