Add basic "join room" overlay

This commit is contained in:
Joscha 2022-02-26 13:11:51 +01:00
parent 8d1b1951f4
commit 3ac3bbb99e
6 changed files with 194 additions and 60 deletions

14
cove-tui/src/ui/layout.rs Normal file
View file

@ -0,0 +1,14 @@
use tui::layout::Rect;
pub fn centered(width: u16, height: u16, area: Rect) -> Rect {
let width = width.min(area.width);
let height = height.min(area.height);
let dx = (area.width - width) / 2;
let dy = (area.height - height) / 2;
Rect {
x: area.x + dx,
y: area.y + dy,
width,
height,
}
}