Skip to content
Snippets Groups Projects
Commit c54ebff2 authored by tag2y19's avatar tag2y19
Browse files

Centre "Team X wins!" text

parent e8d7089d
No related branches found
No related tags found
No related merge requests found
......@@ -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 );
......@@ -493,14 +495,14 @@ static void draw( GtkDrawingArea* area, cairo_t* cr,
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_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;
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment