Different tile sizes for the boards

This commit is contained in:
Simon Cambier 2023-10-10 22:16:39 +02:00
parent 3bec0e91fe
commit 583d4af93e

View File

@ -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()