diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2021-01-16 04:33:09 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2021-01-16 04:33:09 -0300 |
commit | 76681d40623c8a6b8b48ae1108568ed5b799f7ae (patch) | |
tree | ec0a1f303999899e9c1db54d66482a97683cbf29 /src/main.rs | |
parent | 4f2afb1ca7063206411475bce89669238e41cb2b (diff) | |
download | bezier-76681d40623c8a6b8b48ae1108568ed5b799f7ae.tar.gz bezier-76681d40623c8a6b8b48ae1108568ed5b799f7ae.zip |
Run cargo fmt for the first time
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/src/main.rs b/src/main.rs index bd7e1a2..7424f7a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,16 @@ -mod poly; -mod number; mod lerp; +mod number; +mod poly; -use number::Number; use lerp::Lerp; +use number::Number; use std::thread; use std::time::Duration; -use sdl2::pixels::Color; use sdl2::event::Event; use sdl2::keyboard::Keycode; +use sdl2::pixels::Color; use sdl2::rect::Rect; fn main() { @@ -23,7 +23,8 @@ fn main() { let sdl_context = sdl2::init().unwrap(); let video_subsystem = sdl_context.video().unwrap(); - let window = video_subsystem.window("rust-sdl2 demo", 800, 600) + let window = video_subsystem + .window("rust-sdl2 demo", 800, 600) .position_centered() .build() .unwrap(); @@ -36,10 +37,11 @@ fn main() { canvas.clear(); for event in event_pump.poll_iter() { match event { - Event::Quit {..} | - Event::KeyDown { keycode: Some(Keycode::Escape), .. } => { - break 'running - }, + Event::Quit { .. } + | Event::KeyDown { + keycode: Some(Keycode::Escape), + .. + } => break 'running, _ => {} } } @@ -51,13 +53,21 @@ fn main() { let y = k + s * pb.eval(t as Number / 100.0); let z = k + s * p.eval(t as Number / 100.0); canvas.set_draw_color(Color::RGB(180, 20, 20)); - canvas.fill_rect(Rect::new(400 + t, x as i32, 5, 5)).unwrap(); + canvas + .fill_rect(Rect::new(400 + t, x as i32, 5, 5)) + .unwrap(); canvas.set_draw_color(Color::RGB(20, 180, 20)); - canvas.fill_rect(Rect::new(400 + t, y as i32, 5, 5)).unwrap(); + canvas + .fill_rect(Rect::new(400 + t, y as i32, 5, 5)) + .unwrap(); canvas.set_draw_color(Color::RGB(20, 20, 180)); - canvas.fill_rect(Rect::new(400 + t, z as i32, 2, 2)).unwrap(); + canvas + .fill_rect(Rect::new(400 + t, z as i32, 2, 2)) + .unwrap(); canvas.set_draw_color(Color::RGB(255, 0, 0)); - canvas.fill_rect(Rect::new(400 + t, k as i32, 2, 2)).unwrap(); + canvas + .fill_rect(Rect::new(400 + t, k as i32, 2, 2)) + .unwrap(); } canvas.present(); |