From 583d4af93ec5ff7aa7ee885a4c0f8a0e92f7042c Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Tue, 10 Oct 2023 22:16:39 +0200 Subject: [PATCH] Different tile sizes for the boards --- board.lua | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/board.lua b/board.lua index 5b4a92e..bf45bfd 100644 --- a/board.lua +++ b/board.lua @@ -3,8 +3,8 @@ function Board.new() local debug = false local width = board_size - -- tiles - local tile_width = 8 + + local tile_width = 20 -- pixels local padding = 1 local tiles = {} @@ -12,6 +12,16 @@ function Board.new() -- list of indexes local reset = function() + if width == 4 then + tile_width = 20 + elseif width == 6 then + tile_width = 16 + elseif width == 8 then + tile_width = 12 + elseif width == 10 then + tile_width = 8 + end + tiles = {} for i = 1, width * width do tiles[i] = 0 @@ -437,10 +447,15 @@ function Board.new() if color == 1 then fillp(▒) else fillp(█) end if self:is_locked(idx) then rectfill2(x, y, w, w, color) + pset(x + 1, y + 1, shade) + pset(x + w - 2, y + 1, shade) + pset(x + 1, y + w - 2, shade) + pset(x + w - 2, y + w - 2, shade) else roundedrect(x, y, w, w, color) line(x + 1, y + w - 1, x + w - 2, y + w - 1, shade) line(x + w - 1, y + 1, x + w - 1, y + w - 2, shade) + pset(x + w - 2, y + w - 2, shade) end else fillp(█)