Loopy: make line thicknesses scale with the canvas.

This is now important due to Ben's changes in the web frontend. On
high-DPI displays, the canvas is the same overall size as before, but
it's scaled up by increasing the game's tilesize rather than the
browser scaling the image after the game redraws.

Loopy ought to have been scaling its line thicknesses all along, but
forgot. Easily fixed.
This commit is contained in:
Simon Tatham
2022-10-28 21:32:14 +01:00
parent 1e8169ea94
commit ebb079eca0

View File

@ -3295,7 +3295,7 @@ static void game_redraw_line(drawing *dr, game_drawstate *ds,
if (draw_faint_lines) if (draw_faint_lines)
draw_line(dr, x1, y1, x2, y2, line_colour); draw_line(dr, x1, y1, x2, y2, line_colour);
} else { } else {
draw_thick_line(dr, 3.0, draw_thick_line(dr, ds->tilesize*3/32.0,
x1 + 0.5, y1 + 0.5, x1 + 0.5, y1 + 0.5,
x2 + 0.5, y2 + 0.5, x2 + 0.5, y2 + 0.5,
line_colour); line_colour);
@ -3310,7 +3310,7 @@ static void game_redraw_dot(drawing *dr, game_drawstate *ds,
int x, y; int x, y;
grid_to_screen(ds, g, d->x, d->y, &x, &y); grid_to_screen(ds, g, d->x, d->y, &x, &y);
draw_circle(dr, x, y, 2, COL_FOREGROUND, COL_FOREGROUND); draw_circle(dr, x, y, ds->tilesize*2/32.0, COL_FOREGROUND, COL_FOREGROUND);
} }
static bool boxes_intersect(int x0, int y0, int w0, int h0, static bool boxes_intersect(int x0, int y0, int w0, int h0,