Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7fc808b262
|
||
|
|
232377eae1
|
||
|
|
57a486f459
|
No files matched your search
@@ -7,7 +7,6 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
clippy:
|
clippy:
|
||||||
name: clippy
|
name: clippy
|
||||||
|
|||||||
+10
-4
@@ -1,5 +1,6 @@
|
|||||||
use crossterm::event::{Event, EventStream, KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
|
use crossterm::event::{Event, EventStream, KeyCode, KeyEvent, KeyEventKind, KeyModifiers};
|
||||||
use futures::{FutureExt, StreamExt};
|
use futures::{FutureExt, StreamExt};
|
||||||
|
use ratatui::layout::Alignment;
|
||||||
use ratatui::layout::Constraint::Percentage;
|
use ratatui::layout::Constraint::Percentage;
|
||||||
use ratatui::layout::HorizontalAlignment::Center;
|
use ratatui::layout::HorizontalAlignment::Center;
|
||||||
use ratatui::style::Stylize;
|
use ratatui::style::Stylize;
|
||||||
@@ -232,10 +233,14 @@ impl App {
|
|||||||
match self.state {
|
match self.state {
|
||||||
Gamestate::Playing => {
|
Gamestate::Playing => {
|
||||||
let canvas = Canvas::default()
|
let canvas = Canvas::default()
|
||||||
.block(Block::bordered().title(format!(
|
.block(
|
||||||
"PongRS | {} - {}",
|
Block::bordered()
|
||||||
self.player_score, self.enemy_score
|
.title(format!(
|
||||||
)))
|
" PongRS | {} - {} ",
|
||||||
|
self.player_score, self.enemy_score
|
||||||
|
))
|
||||||
|
.title_alignment(Alignment::Center),
|
||||||
|
)
|
||||||
.x_bounds([X_BOUNDS.0, X_BOUNDS.1])
|
.x_bounds([X_BOUNDS.0, X_BOUNDS.1])
|
||||||
.y_bounds([Y_BOUNDS.0, Y_BOUNDS.1])
|
.y_bounds([Y_BOUNDS.0, Y_BOUNDS.1])
|
||||||
.marker(Marker::Block)
|
.marker(Marker::Block)
|
||||||
@@ -329,6 +334,7 @@ impl App {
|
|||||||
Gamestate::Won => self.restart(),
|
Gamestate::Won => self.restart(),
|
||||||
Gamestate::Lost => self.restart(),
|
Gamestate::Lost => self.restart(),
|
||||||
},
|
},
|
||||||
|
(_, KeyCode::Char('r')) => self.restart(),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user