Scripts work again.
All checks were successful
Build Dusk / run-tests (push) Successful in 1m40s
Build Dusk / build-linux (push) Successful in 1m45s
Build Dusk / build-psp (push) Successful in 1m47s
Build Dusk / build-dolphin (push) Successful in 2m23s

This commit is contained in:
2026-02-13 19:36:59 -06:00
parent e5e8c49f6c
commit af9904c892
22 changed files with 183 additions and 282 deletions

View File

@@ -18,39 +18,39 @@ CELL_STATE_DISABLED = 3
screenSetBackground(colorBlack())
camera = cameraCreate(CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC)
tilesetUi = tilesetGetByName("ui")
textureUi = textureLoad(tilesetUi.texture)
-- tilesetUi = tilesetGetByName("ui")
-- textureUi = textureLoad(tilesetUi.texture)
tilesetBorder = tilesetGetByName("border")
textureBorder = textureLoad(tilesetBorder.texture)
-- tilesetBorder = tilesetGetByName("border")
-- textureBorder = textureLoad(tilesetBorder.texture)
textureGrid = textureLoad("minesweeper/grid_bg.dpi")
-- textureGrid = textureLoad("minesweeper/grid_bg.dpi")
tilesetCell = tilesetGetByName("cell")
textureCell = textureLoad(tilesetCell.texture)
cellSliceDefault = tilesetPositionGetUV(tilesetCell, 3, 5)
cellSliceHover = tilesetPositionGetUV(tilesetCell, 3, 4)
cellSliceDown = tilesetPositionGetUV(tilesetCell, 3, 6)
cellSliceDisabled = tilesetPositionGetUV(tilesetCell, 3, 7)
-- tilesetCell = tilesetGetByName("cell")
-- textureCell = textureLoad(tilesetCell.texture)
-- cellSliceDefault = tilesetPositionGetUV(tilesetCell, 3, 5)
-- cellSliceHover = tilesetPositionGetUV(tilesetCell, 3, 4)
-- cellSliceDown = tilesetPositionGetUV(tilesetCell, 3, 6)
-- cellSliceDisabled = tilesetPositionGetUV(tilesetCell, 3, 7)
sweepwerCols = 10
sweeperRows = 14
-- sweepwerCols = 10
-- sweeperRows = 14
mouseX = -1
mouseY = -1
centerX = 0
centerY = 0
boardWidth = sweepwerCols * tilesetCell.tileWidth
boardHeight = sweeperRows * tilesetCell.tileHeight
-- mouseX = -1
-- mouseY = -1
-- centerX = 0
-- centerY = 0
-- boardWidth = sweepwerCols * tilesetCell.tileWidth
-- boardHeight = sweeperRows * tilesetCell.tileHeight
i = 0
cells = {}
for y = 1, sweeperRows do
for x = 1, sweepwerCols do
cells[i] = CELL_STATE_DEFAULT
i = i + 1
end
end
-- i = 0
-- cells = {}
-- for y = 1, sweeperRows do
-- for x = 1, sweepwerCols do
-- cells[i] = CELL_STATE_DEFAULT
-- i = i + 1
-- end
-- end
function cellDraw(x, y, type)
local slice = cellSliceDefault
@@ -189,42 +189,53 @@ function sceneRender()
mouseY = inputGetValue(INPUT_ACTION_POINTERY) * screenGetHeight()
end
centerX = math.floor(screenGetWidth() / 2)
centerY = math.floor(screenGetHeight() / 2)
-- Draw elements
backgroundDraw()
borderDraw(
centerX - (boardWidth / 2), centerY - (boardHeight / 2),
boardWidth, boardHeight
-- Draw cursor
spriteBatchPush(
nil,
mouseX - 2, mouseY - 2,
mouseX + 2, mouseY + 2,
colorRed(),
0, 0,
1, 1
)
i = 0
-- Foreach cell
local offX = centerX - (boardWidth / 2)
local offY = centerY - (boardHeight / 2)
for y = 0, sweeperRows - 1 do
for x = 0, sweepwerCols - 1 do
i = y * sweepwerCols + x
-- centerX = math.floor(screenGetWidth() / 2)
-- centerY = math.floor(screenGetHeight() / 2)
-- Draw elements
-- backgroundDraw()
-- borderDraw(
-- centerX - (boardWidth / 2), centerY - (boardHeight / 2),
-- boardWidth, boardHeight
-- )
-- i = 0
-- -- Foreach cell
-- local offX = centerX - (boardWidth / 2)
-- local offY = centerY - (boardHeight / 2)
-- for y = 0, sweeperRows - 1 do
-- for x = 0, sweepwerCols - 1 do
-- i = y * sweepwerCols + x
-- Hovered
if
cells[i] == CELL_STATE_DEFAULT and
mouseX >= x * tilesetCell.tileWidth + offX and mouseX < (x + 1) * tilesetCell.tileWidth + offX and
mouseY >= y * tilesetCell.tileHeight + offY and mouseY < (y + 1) * tilesetCell.tileHeight + offY
then
cells[i] = CELL_STATE_HOVER
else
cells[i] = CELL_STATE_DEFAULT
end
-- -- Hovered
-- if
-- cells[i] == CELL_STATE_DEFAULT and
-- mouseX >= x * tilesetCell.tileWidth + offX and mouseX < (x + 1) * tilesetCell.tileWidth + offX and
-- mouseY >= y * tilesetCell.tileHeight + offY and mouseY < (y + 1) * tilesetCell.tileHeight + offY
-- then
-- cells[i] = CELL_STATE_HOVER
-- else
-- cells[i] = CELL_STATE_DEFAULT
-- end
cellDraw(
x * tilesetCell.tileWidth + offX,
y * tilesetCell.tileHeight + offY,
cells[i]
)
end
end
-- cellDraw(
-- x * tilesetCell.tileWidth + offX,
-- y * tilesetCell.tileHeight + offY,
-- cells[i]
-- )
-- end
-- end
spriteBatchFlush()
cameraPopMatrix()