-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b84b77
commit b6a8257
Showing
8 changed files
with
55 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
pub mod ascii_text; | ||
pub mod cards; | ||
pub mod inputs; | ||
pub mod layouts; | ||
pub mod popups; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
use ratatui::{ | ||
layout::{Constraint, Direction, Layout, Rect}, | ||
Frame, | ||
}; | ||
|
||
pub struct MenuLayout { | ||
pub header_area: Rect, | ||
pub sub_header_area: Rect, | ||
pub menu_area: Rect, | ||
pub menu_option_areas: Vec<Rect>, | ||
} | ||
|
||
impl MenuLayout { | ||
pub fn new(frame: &mut Frame, num_menu_options: usize) -> Self { | ||
let layout_base = Layout::default() | ||
.direction(Direction::Vertical) | ||
.constraints([ | ||
Constraint::Fill(1), | ||
Constraint::Length(5), | ||
Constraint::Fill(4), | ||
]) | ||
.split(frame.size()); | ||
let layout_bottom = Layout::default() | ||
.direction(Direction::Horizontal) | ||
.constraints([ | ||
Constraint::Fill(1), | ||
Constraint::Length(42), | ||
Constraint::Fill(1), | ||
]) | ||
.split(layout_base[2]); | ||
let layout_menu = Layout::default() | ||
.direction(Direction::Vertical) | ||
.constraints([Constraint::Length(3), Constraint::Fill(1)]) | ||
.split(layout_bottom[1]); | ||
let layout_menu_options = Layout::default() | ||
.direction(Direction::Vertical) | ||
.constraints([Constraint::Length(3)].repeat(num_menu_options)) | ||
.split(layout_menu[1]); | ||
Self { | ||
header_area: layout_base[1], | ||
sub_header_area: layout_menu[0], | ||
menu_area: layout_menu[1], | ||
menu_option_areas: layout_menu_options.to_vec(), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
pub mod game; | ||
pub mod menu; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod components; | ||
pub mod interface_callback; | ||
pub mod layouts; | ||
pub mod screens; | ||
|
||
use crate::interface::{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters