@@ -24,6 +24,11 @@ struct advisor_rating_window {
24
24
vec2i outer_panel_size;
25
25
e_image_id advisor_icon_image;
26
26
vec2i advisor_icon_pos;
27
+ vec2i header_pos;
28
+ vec2i header_population_pos;
29
+ vec2i background_img_pos;
30
+ e_image_id background_img;
31
+ vec2i column_offset;
27
32
};
28
33
29
34
advisor_rating_window g_advisor_rating_window;
@@ -35,6 +40,11 @@ void config_load_advisor_rating() {
35
40
w.outer_panel_size = arch.r_size2i (" outer_panel_size" );
36
41
w.advisor_icon_image = arch.r_image (" advisor_icon_image" );
37
42
w.advisor_icon_pos = arch.r_vec2i (" advisor_icon_pos" );
43
+ w.header_pos = arch.r_vec2i (" header_pos" );
44
+ w.header_population_pos = arch.r_vec2i (" header_population_pos" );
45
+ w.background_img = arch.r_image (" background_img" );
46
+ w.background_img_pos = arch.r_vec2i (" background_img_pos" );
47
+ w.column_offset = arch.r_vec2i (" column_offset" );
38
48
});
39
49
}
40
50
@@ -69,6 +79,7 @@ static void draw_rating_column(int x_offset, int y_offset, int value, int has_re
69
79
}
70
80
71
81
static void draw_rating (int id, int value, int open_play, int goal) {
82
+ auto &w = g_advisor_rating_window;
72
83
// int value = city_rating_culture();
73
84
int enabled = !open_play && goal;
74
85
button_border_draw (rating_buttons[id].x , rating_buttons[id].y , rating_buttons[id].width , rating_buttons[id].height , focus_button_id == SELECTED_RATING_CULTURE);
@@ -77,28 +88,27 @@ static void draw_rating(int id, int value, int open_play, int goal) {
77
88
int width = text_draw_number (enabled ? goal : 0 , ' @' , " " , rating_buttons[id].x + 5 , rating_buttons[id].y + 45 , FONT_NORMAL_BLACK_ON_LIGHT);
78
89
lang_text_draw (53 , 5 , rating_buttons[id].x + 5 + width, rating_buttons[id].y + 45 , FONT_NORMAL_BLACK_ON_LIGHT);
79
90
int has_reached = !enabled || value >= goal;
80
- draw_rating_column (rating_buttons[id].x + 30 , rating_buttons[id].y , value, has_reached);
91
+ draw_rating_column (rating_buttons[id].x + w. column_offset . x , rating_buttons[id]. y + w. column_offset .y , value, has_reached);
81
92
}
82
93
83
94
static int draw_background () {
84
95
return g_advisor_rating_window.outer_panel_size .y ;
85
96
}
86
97
87
98
static void draw_foreground () {
88
- painter ctx = game.painter ();
89
-
90
99
auto &w = g_advisor_rating_window;
91
100
ui::panel (w.outer_panel_pos , w.outer_panel_size , UiFlags_PanelOuter);
92
101
ui::icon (w.advisor_icon_pos , ADVISOR_RATINGS);
93
102
94
- int width = lang_text_draw (53 , 0 , 60 , 12 , FONT_LARGE_BLACK_ON_LIGHT);
95
- if (!winning_population () || scenario_is_open_play ()) {
96
- lang_text_draw (53 , 7 , 80 + width, 17 , FONT_NORMAL_BLACK_ON_LIGHT);
97
- } else {
98
- width += lang_text_draw (53 , 6 , 80 + width, 17 , FONT_NORMAL_BLACK_ON_LIGHT);
99
- text_draw_number (winning_population (), ' @' , " )" , 80 + width, 17 , FONT_NORMAL_BLACK_ON_LIGHT);
103
+ ui::label (53 , 0 , w.header_pos , FONT_LARGE_BLACK_ON_LIGHT);
104
+ bstring128 caption = (pcstr)ui::str (53 , 7 );
105
+ if (!(!winning_population () || scenario_is_open_play ())) {
106
+ caption = (pcstr)ui::str (53 , 6 );
107
+ caption.append (" %u" , winning_population ());
100
108
}
101
- ImageDraw::img_generic (ctx, image_id_from_group (GROUP_ADVISOR_RATINGS_BACKGROUND), 60 , 48 - 10 );
109
+
110
+ ui::label (caption, w.header_population_pos , FONT_NORMAL_BLACK_ON_LIGHT);
111
+ ui::image (w.background_img , w.background_img_pos );
102
112
103
113
int open_play = scenario_is_open_play ();
104
114
0 commit comments