1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-24 06:59:10 +00:00

(svn r23497) -Add: Advanced display setting to control the linewidth in graphs. (ChillCore)

This commit is contained in:
frosch
2011-12-11 15:55:31 +00:00
parent 8f36e70e35
commit 1ea449630d
5 changed files with 18 additions and 2 deletions

View File

@@ -419,6 +419,9 @@ protected:
}
/* draw lines and dots */
uint linewidth = _settings_client.gui.graph_line_thickness;
uint pointoffs1 = (linewidth + 1) / 2;
uint pointoffs2 = linewidth + 1 - pointoffs1;
for (int i = 0; i < this->num_dataset; i++) {
if (!HasBit(this->excluded_data, i)) {
/* Centre the dot between the grid lines. */
@@ -455,10 +458,10 @@ protected:
y = r.top + x_axis_offset - ((r.bottom - r.top) * datapoint) / (interval_size >> reduce_range);
/* Draw the point. */
GfxFillRect(x - 2, y - 2, x + 2, y + 2, colour);
GfxFillRect(x - pointoffs1, y - pointoffs1, x + pointoffs2, y + pointoffs2, colour);
/* Draw the line connected to the previous point. */
if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, colour, 3);
if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, colour, linewidth);
prev_x = x;
prev_y = y;