From c54ebff2c915e03d52d19fae428b946799c31d0d Mon Sep 17 00:00:00 2001 From: Tom Greig <tag2y19@soton.ac.uk> Date: Mon, 17 Mar 2025 10:19:08 +0000 Subject: [PATCH] Centre "Team X wins!" text --- src/window.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/window.c b/src/window.c index 394f045..5ecf7c6 100644 --- a/src/window.c +++ b/src/window.c @@ -482,9 +482,11 @@ static void draw( GtkDrawingArea* area, cairo_t* cr, case DONE: { - pango_font_description_set_absolute_size( desc, - PANGO_SCALE * ( 0.4 * height < 0.33 * width ? - 0.2 * height : 0.16 * width ) ); + double size = ( 0.4 * height < 0.33 * width ? + 0.2 * height : 0.16 * width ); + size = 100; + pango_font_description_set_absolute_size( + desc, PANGO_SCALE * size ); PangoLayout* layout = pango_cairo_create_layout( cr ); pango_layout_set_font_description( layout, desc ); @@ -492,15 +494,15 @@ static void draw( GtkDrawingArea* area, cairo_t* cr, pango_layout_set_text( layout, window->score.team_1 >= window->score.team_2 ? "Team 1 Wins!" : "Team 2 Wins!", -1 ); - pango_layout_set_width( layout, PANGO_SCALE* 0.8 * width ); - //pango_layout_set_alignment( layout, PANGO_ALIGN_CENTER ); + pango_layout_set_width( layout, PANGO_SCALE * 0.8 * width ); + pango_layout_set_alignment( layout, PANGO_ALIGN_CENTER ); int lw, lh; pango_layout_get_pixel_size( layout, &lw, &lh ); - cairo_move_to( cr, 0.5 * width - lw / 2, - 0.5 * height - lh / 2 ); set_cario_colour( cr, WHITE ); + cairo_move_to( cr, + 0.1 * width, ( height - lh ) / 2 ); pango_cairo_show_layout( cr, layout ); break; -- GitLab