improve drawing of empty tiles.
make empty tiles render as 2x2 squares, fixing color alignment and chirality issues. also make corners and centers of boxes be marked by empty tiles there being darker than usual.
This commit is contained in:
parent
7c7d939905
commit
9193a43fbc
|
@ -21,14 +21,29 @@ function checkerboard (x, y) {
|
|||
return ((x ^ y) & 1) === 0;
|
||||
}
|
||||
|
||||
function should_be_darker (x, y) {
|
||||
const CENTER = world.CENTER;
|
||||
const BOX_SIZE = world.BOX_SIZE;
|
||||
|
||||
return x === CENTER && y === CENTER
|
||||
|| (x === 0 || x === BOX_SIZE - 1) && (y === 0 || y === BOX_SIZE - 1)
|
||||
}
|
||||
|
||||
export function draw_floor (start_x, start_y, scale, invert = false) {
|
||||
iter_2d(range(0, world.BOX_SIZE - 1), (x, y) => {
|
||||
if (checkerboard(x, y) !== invert) {
|
||||
graphics.set_color("#aaa");
|
||||
} else {
|
||||
graphics.set_color("#888");
|
||||
let dark = "#888";
|
||||
let bright = "#aaa";
|
||||
if (should_be_darker(x, y)) {
|
||||
dark = "#555";
|
||||
bright = "#666";
|
||||
}
|
||||
|
||||
graphics.set_color(dark);
|
||||
draw_rect(x * scale + start_x, y * scale + start_y, scale);
|
||||
|
||||
graphics.set_color(bright);
|
||||
draw_rect(x * scale + start_x, y * scale + start_y, scale / 2);
|
||||
draw_rect((x + 0.5) * scale + start_x, (y + 0.5) * scale + start_y, scale / 2);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue