4 * The geeky little puzzle game with a big noodly crunch!
6 * gPlanarity copyright (C) 2005 Monty <monty@xiph.org>
7 * Original Flash game by John Tantalo <john.tantalo@case.edu>
8 * Original game concept by Mary Radcliffe
10 * gPlanarity is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
15 * gPlanarity is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Postfish; see the file COPYING. If not, write to the
22 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
29 #include <gtk/gtkmain.h>
37 #include "gameboard.h"
38 #include "levelstate.h"
41 void draw_score(Gameboard
*g
){
42 char level_string
[160];
43 char score_string
[160];
44 char mult_string
[160];
47 cairo_text_extents_t extentsL
;
48 cairo_text_extents_t extentsS
;
49 cairo_text_extents_t extentsM
;
50 cairo_text_extents_t extentsO
;
51 cairo_text_extents_t extentsI
;
53 cairo_t
*c
= cairo_create(g
->forescore
);
60 cairo_set_operator(c
,CAIRO_OPERATOR_CLEAR
);
61 cairo_set_source_rgba (c
, 1,1,1,1);
65 topbox(g
,c
,g
->g
.width
,SCOREHEIGHT
);
67 snprintf(level_string
,160,_("Level %d: %s"),get_level_num()+1,get_level_desc());
68 snprintf(score_string
,160,_("Score: %d"),graphscore_get_raw_score(&g
->g
));
69 snprintf(mult_string
,160,_("%d%%"),graphscore_get_multiplier_percent(&g
->g
));
70 snprintf(int_string
,160,_("Intersections: %ld"),g
->g
.active_intersections
);
71 snprintf(obj_string
,160,_("Objective: %s"),graphscore_objective_string(&g
->g
));
73 set_font(c
,xpx
,15,0,1);
74 cairo_set_source_rgba (c
, TEXT_COLOR
);
76 cairo_text_extents (c
, obj_string
, &extentsO
);
77 cairo_text_extents (c
, int_string
, &extentsI
);
78 cairo_text_extents (c
, score_string
, &extentsS
);
79 cairo_text_extents (c
, mult_string
, &extentsM
);
82 cairo_move_to (c
, 15, ty1
);
83 cairo_show_text (c
, int_string
);
84 cairo_move_to (c
, 15, ty2
);
85 cairo_show_text (c
, score_string
);
86 if(graphscore_get_multiplier_percent(&g
->g
)>100){
88 cairo_set_source_rgba (c
, HIGH_COLOR
);
89 cairo_move_to (c
, 15 + extentsS
.width
+10, ty2
);
90 cairo_show_text (c
, mult_string
);
94 cairo_move_to (c
, g
->g
.width
-extentsO
.width
-15, ty2
);
95 cairo_show_text (c
, obj_string
);
99 cairo_text_extents (c
, level_string
, &extentsL
);
101 if(extentsL
.width
> 300){
103 set_font(c
,xpx
,15,0,1);
108 cairo_move_to (c
, g
->g
.width
-extentsL
.width
-15, ty1
);
109 cairo_show_text (c
, level_string
);
114 void update_score(Gameboard
*g
){
121 r
.height
= SCOREHEIGHT
;
122 gdk_window_invalidate_rect (g
->w
.window
, &r
, FALSE
);