Mercurial > hg > openttd
comparison src/graph_gui.cpp @ 5793:50846c721bda draft
(svn r8350) -Codechange: [Graphs] Use DrawStringCentered instead of a hardcoded offset to make the string appear centred.
author | maedhros <maedhros@openttd.org> |
---|---|
date | Mon, 22 Jan 2007 16:26:45 +0000 |
parents | 4fd992bac142 |
children | 54b69ef4b352 |
comparison
equal
deleted
inserted
replaced
5792:88cf2dc7e649 | 5793:50846c721bda |
---|---|
180 year++; | 180 year++; |
181 } | 181 } |
182 x += GRAPH_X_POSITION_SEPARATION; | 182 x += GRAPH_X_POSITION_SEPARATION; |
183 } | 183 } |
184 } else { | 184 } else { |
185 /* Add 8 to make the string appear centred between the lines. */ | 185 /* Draw the label under the data point rather than on the grid line. */ |
186 x = gw->left + GRAPH_X_POSITION_BEGINNING + 8; | 186 x = gw->left + GRAPH_X_POSITION_BEGINNING + (GRAPH_X_POSITION_SEPARATION / 2) + 1; |
187 y = gw->top + gw->height + 1; | 187 y = gw->top + gw->height + 1; |
188 uint16 label = gw->x_values_start; | 188 uint16 label = gw->x_values_start; |
189 | 189 |
190 for (int i = 0; i < gw->num_on_x_axis; i++) { | 190 for (int i = 0; i < gw->num_on_x_axis; i++) { |
191 SetDParam(0, label); | 191 SetDParam(0, label); |
192 DrawString(x, y, STR_01CB, GRAPH_AXIS_LABEL_COLOUR); | 192 DrawStringCentered(x, y, STR_01CB, GRAPH_AXIS_LABEL_COLOUR); |
193 | |
193 label += gw->x_values_increment; | 194 label += gw->x_values_increment; |
194 x += GRAPH_X_POSITION_SEPARATION; | 195 x += GRAPH_X_POSITION_SEPARATION; |
195 } | 196 } |
196 } | 197 } |
197 | 198 |