mirror of
https://github.com/ricoriedel/wipe.git
synced 2024-12-23 06:36:42 +00:00
Add vec.rs
This commit is contained in:
parent
c193d5897a
commit
57bbb6e9a7
15
src/vec.rs
Normal file
15
src/vec.rs
Normal file
@ -0,0 +1,15 @@
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Vector {
|
||||
pub x: f32,
|
||||
pub y: f32
|
||||
}
|
||||
|
||||
impl Vector {
|
||||
pub fn new(x: f32, y: f32) -> Self {
|
||||
Self { x, y }
|
||||
}
|
||||
|
||||
pub fn from_terminal(x: usize, y: usize) -> Self {
|
||||
Vector::new(x as f32, y as f32 * 2.0)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user