Trying to find dolphin texture bug
This commit is contained in:
@@ -5,4 +5,4 @@
|
||||
|
||||
add_asset(TILESET ui.png type=PALETTIZED tileWidth=8 tileHeight=8)
|
||||
add_asset(TILESET cell.png type=PALETTIZED tileWidth=8 tileHeight=8)
|
||||
add_asset(TILESET grid.png type=PALETTIZED tileWidth=8 tileHeight=8)
|
||||
add_asset(IMAGE grid_bg.png type=PALETTIZED)
|
||||
BIN
assets/minesweeper/grid_bg.png
Normal file
BIN
assets/minesweeper/grid_bg.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 123 B |
@@ -20,10 +20,7 @@ camera = cameraCreate(CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC)
|
||||
tilesetUi = tilesetGetByName("ui")
|
||||
textureUi = textureLoad(tilesetUi.texture)
|
||||
|
||||
tilesetGrid = tilesetGetByName("grid")
|
||||
textureGrid = textureLoad(tilesetGrid.texture)
|
||||
gridPiece = tilesetPositionGetUV(tilesetGrid, 0, 0)
|
||||
gridSlice = tilesetPositionGetUV(tilesetGrid, 11, 3)
|
||||
textureGrid = textureLoad("minesweeper/grid_bg.dpi")
|
||||
|
||||
tilesetCell = tilesetGetByName("cell")
|
||||
textureCell = textureLoad(tilesetCell.texture)
|
||||
@@ -65,28 +62,21 @@ function cellDraw(x, y, type)
|
||||
end
|
||||
|
||||
function backgroundDraw()
|
||||
local t = (TIME.time * 3) % 1
|
||||
local offXStart = gridPiece.u1 * t
|
||||
local offYStart = gridPiece.v1 * t
|
||||
local offXEnd = offXStart + gridPiece.u1
|
||||
local offYEnd = offYStart + gridPiece.v1
|
||||
|
||||
-- Tile background
|
||||
local cols = math.ceil(screenGetWidth() / tilesetGrid.tileWidth)
|
||||
local rows = math.ceil(screenGetHeight() / tilesetGrid.tileHeight)
|
||||
local t = (TIME.time / 20) % 1
|
||||
local scaleX = screenGetWidth() / textureGrid.width
|
||||
local scaleY = screenGetHeight() / textureGrid.height
|
||||
local u0 = t * scaleX
|
||||
local v0 = t * scaleY
|
||||
local u1 = scaleX + u0
|
||||
local v1 = scaleY + v0
|
||||
|
||||
for y = 0, rows do
|
||||
for x = 0, cols do
|
||||
spriteBatchPush(
|
||||
textureGrid,
|
||||
x * tilesetGrid.tileWidth, y * tilesetGrid.tileHeight,
|
||||
(x + 1) * tilesetGrid.tileWidth, (y + 1) * tilesetGrid.tileHeight,
|
||||
colorWhite(),
|
||||
gridSlice.u0 + offXStart, gridSlice.v0 + offYStart,
|
||||
gridSlice.u1 + offXEnd, gridSlice.v1 + offYEnd
|
||||
)
|
||||
end
|
||||
end
|
||||
spriteBatchPush(textureGrid,
|
||||
0, 0,
|
||||
screenGetWidth(), screenGetHeight(),
|
||||
colorWhite(),
|
||||
u0, v0,
|
||||
u1, v1
|
||||
)
|
||||
end
|
||||
|
||||
function sceneDispose()
|
||||
@@ -112,6 +102,7 @@ function sceneRender()
|
||||
y * tilesetCell.tileHeight + offsetY,
|
||||
cells[i]
|
||||
)
|
||||
break
|
||||
end
|
||||
end
|
||||
spriteBatchFlush()
|
||||
|
||||
Reference in New Issue
Block a user