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, ...@@ -482,9 +482,11 @@ static void draw( GtkDrawingArea* area, cairo_t* cr,
case DONE: { case DONE: {
pango_font_description_set_absolute_size( desc, double size = ( 0.4 * height < 0.33 * width ?
PANGO_SCALE * ( 0.4 * height < 0.33 * width ? 0.2 * height : 0.16 * 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 ); PangoLayout* layout = pango_cairo_create_layout( cr );
pango_layout_set_font_description( layout, desc ); pango_layout_set_font_description( layout, desc );
...@@ -492,15 +494,15 @@ static void draw( GtkDrawingArea* area, cairo_t* cr, ...@@ -492,15 +494,15 @@ static void draw( GtkDrawingArea* area, cairo_t* cr,
pango_layout_set_text( layout, pango_layout_set_text( layout,
window->score.team_1 >= window->score.team_2 ? window->score.team_1 >= window->score.team_2 ?
"Team 1 Wins!" : "Team 2 Wins!", -1 ); "Team 1 Wins!" : "Team 2 Wins!", -1 );
pango_layout_set_width( layout, PANGO_SCALE* 0.8 * width ); 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; int lw, lh;
pango_layout_get_pixel_size( layout, &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 ); set_cario_colour( cr, WHITE );
cairo_move_to( cr,
0.1 * width, ( height - lh ) / 2 );
pango_cairo_show_layout( cr, layout ); pango_cairo_show_layout( cr, layout );
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment