From 57a486f4598ac26c668820cc354b67617eaf9984 Mon Sep 17 00:00:00 2001 From: nicknase27 Date: Wed, 30 Sep 2026 12:01:01 +0200 Subject: [PATCH] Fix title position --- .gitea/workflows/build.yml | 5 ++--- src/main.rs | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index a6b6e48..f3a8d97 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -6,8 +6,7 @@ on: - "v*" env: - CARGO_TERM_COLOR: always - + CARGO_TERM_COLOR: alway jobs: clippy: name: clippy @@ -83,4 +82,4 @@ jobs: with: files: | artifacts/pongrs - artifacts/pongrs.exe \ No newline at end of file + artifacts/pongrs.exe diff --git a/src/main.rs b/src/main.rs index c226e22..45ef5bb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ use crossterm::event::{Event, EventStream, KeyCode, KeyEvent, KeyEventKind, KeyModifiers}; use futures::{FutureExt, StreamExt}; +use ratatui::layout::Alignment; use ratatui::layout::Constraint::Percentage; use ratatui::layout::HorizontalAlignment::Center; use ratatui::style::Stylize; @@ -90,7 +91,7 @@ impl Ball { self.x_velocity = -0.5; self.y_velocity = 0.5; } - } + } } #[derive(Debug, Default)] @@ -233,9 +234,9 @@ impl App { Gamestate::Playing => { let canvas = Canvas::default() .block(Block::bordered().title(format!( - "PongRS | {} - {}", + " PongRS | {} - {} ", self.player_score, self.enemy_score - ))) + )).title_alignment(Alignment::Center)) .x_bounds([X_BOUNDS.0, X_BOUNDS.1]) .y_bounds([Y_BOUNDS.0, Y_BOUNDS.1]) .marker(Marker::Block)