Fix appearance issues
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pierre HUBERT 2022-10-17 19:00:13 +02:00
parent 38656661b4
commit 0280daf6d2
2 changed files with 14 additions and 10 deletions

View File

@ -63,7 +63,7 @@ impl GameRulesConfigurationScreen {
.checked_sub(last_tick.elapsed()) .checked_sub(last_tick.elapsed())
.unwrap_or_else(|| Duration::from_secs(0)); .unwrap_or_else(|| Duration::from_secs(0));
if crossterm::event::poll(timeout)? { if event::poll(timeout)? {
let mut cursor_pos = self.curr_field as i32; let mut cursor_pos = self.curr_field as i32;
if let Event::Key(key) = event::read()? { if let Event::Key(key) = event::read()? {
@ -189,7 +189,9 @@ impl GameRulesConfigurationScreen {
let area = centered_rect_size(w, h, &f.size()); let area = centered_rect_size(w, h, &f.size());
let block = Block::default().title("Game rules").borders(Borders::ALL); let block = Block::default()
.title("📓 Game rules")
.borders(Borders::ALL);
f.render_widget(block, area); f.render_widget(block, area);
let chunks = Layout::default() let chunks = Layout::default()

View File

@ -136,7 +136,7 @@ impl GameScreen {
.unwrap_or_else(|| Duration::from_secs(0)); .unwrap_or_else(|| Duration::from_secs(0));
// Handle terminal events // Handle terminal events
if crossterm::event::poll(timeout)? { if event::poll(timeout)? {
let event = event::read()?; let event = event::read()?;
// Keyboard event // Keyboard event
@ -571,15 +571,17 @@ impl GameScreen {
if show_both_maps { if show_both_maps {
let maps_chunks = Layout::default() let maps_chunks = Layout::default()
.direction(Direction::Horizontal) .direction(Direction::Horizontal)
.constraints([ .constraints([Constraint::Percentage(50), Constraint::Percentage(50)])
Constraint::Length(player_map_size.0),
Constraint::Length(3),
Constraint::Length(opponent_map_size.0),
])
.split(chunks[2]); .split(chunks[2]);
f.render_widget(player_map, maps_chunks[0]); f.render_widget(
f.render_widget(opponent_map, maps_chunks[2]); player_map,
centered_rect_size(player_map_size.0, player_map_size.1, &maps_chunks[0]),
);
f.render_widget(
opponent_map,
centered_rect_size(opponent_map_size.0, opponent_map_size.1, &maps_chunks[1]),
);
} else { } else {
// Render a single map // Render a single map
if self.can_fire() { if self.can_fire() {