Fix title position

This commit is contained in:
nicknase27 committed 2026-09-30 12:01:01 +02:00
1 parent d14b6c750c
commit 57a486f459
2 files changed
+6 -6

No files matched your search

+2 -3
View File
@@ -6,8 +6,7 @@ on:
- "v*" - "v*"
env: env:
CARGO_TERM_COLOR: always CARGO_TERM_COLOR: alway
jobs: jobs:
clippy: clippy:
name: clippy name: clippy
@@ -83,4 +82,4 @@ jobs:
with: with:
files: | files: |
artifacts/pongrs artifacts/pongrs
artifacts/pongrs.exe artifacts/pongrs.exe
+4 -3
View File
@@ -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;
@@ -90,7 +91,7 @@ impl Ball {
self.x_velocity = -0.5; self.x_velocity = -0.5;
self.y_velocity = 0.5; self.y_velocity = 0.5;
} }
} }
} }
#[derive(Debug, Default)] #[derive(Debug, Default)]
@@ -233,9 +234,9 @@ impl App {
Gamestate::Playing => { Gamestate::Playing => {
let canvas = Canvas::default() let canvas = Canvas::default()
.block(Block::bordered().title(format!( .block(Block::bordered().title(format!(
"PongRS | {} - {}", " PongRS | {} - {} ",
self.player_score, self.enemy_score 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)