diff options
author | Juan Manuel Tomás <jtomas1815@gmail.com> | 2021-01-31 02:41:18 -0300 |
---|---|---|
committer | Juan Manuel Tomás <jtomas1815@gmail.com> | 2021-01-31 02:41:18 -0300 |
commit | d6341b9195553af6dfb8bfc9d94c19e6cc000247 (patch) | |
tree | 546b204d15714993689c85136a3ffcaac04087f2 /src/main.rs | |
parent | c0089dd0567b8d6538360a21f042cbb0913fff99 (diff) | |
download | bezier-d6341b9195553af6dfb8bfc9d94c19e6cc000247.tar.gz bezier-d6341b9195553af6dfb8bfc9d94c19e6cc000247.zip |
Change the curve style
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs index e6f3720..add9d00 100644 --- a/src/main.rs +++ b/src/main.rs @@ -63,6 +63,7 @@ fn main() { 'running: loop { let x = event_pump.mouse_state().x(); let y = event_pump.mouse_state().y(); + let left_click = event_pump.mouse_state().left(); for event in event_pump.poll_iter() { match event { Event::Quit { .. } @@ -76,6 +77,12 @@ fn main() { } => { curve.push(x, window_h as i32 - y); curve.draw(); + }, + Event::MouseMotion { .. } => { + if left_click { + curve.grab_closer(x as f32, (window_h as i32 - y) as f32); + curve.draw(); + } } _ => {} } |