diff options
author | rabite <rabite@posteo.de> | 2019-03-19 01:08:22 +0100 |
---|---|---|
committer | rabite <rabite@posteo.de> | 2019-03-19 14:38:15 +0100 |
commit | 161ba5ac3f38733b45c0167cb1e29f0be6059775 (patch) | |
tree | 794ec2517c71f6e6e3b9c572ebcc0e2fca66c3f4 /src/coordinates.rs | |
parent | c719ec7a3cb6ca3d2346f48dc11d2e0d5ee10d36 (diff) |
handle terminal resizing
Diffstat (limited to 'src/coordinates.rs')
-rw-r--r-- | src/coordinates.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/coordinates.rs b/src/coordinates.rs index 3a76030..735286a 100644 --- a/src/coordinates.rs +++ b/src/coordinates.rs @@ -32,6 +32,10 @@ impl Coordinates { self.size.0 = (x, y); } + pub fn set_size_u(&mut self, x: usize, y: usize) { + self.size.0 = ((x+1) as u16, (y+1) as u16); + } + pub fn set_xsize(&mut self, x: u16) { (self.size.0).0 = x; } @@ -44,6 +48,10 @@ impl Coordinates { self.position.0 = (x, y); } + pub fn set_position_u(&mut self, x: usize, y: usize) { + self.position.0 = ((x+1) as u16, (y+1) as u16); + } + pub fn set_xpos(&mut self, x: u16) { (self.position.0).0 = x; } |