mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-18 05:25:20 +01:00
feat: improve ghost piece visibility with three-layer design for better accessibility
This commit is contained in:
parent
e23d33e2e2
commit
03ff049bef
1 changed files with 50 additions and 2 deletions
|
@ -179,6 +179,26 @@ class GameView @JvmOverloads constructor(
|
||||||
private var isPulsing = false
|
private var isPulsing = false
|
||||||
private var linesToPulse = mutableListOf<Int>() // Track which lines are being cleared
|
private var linesToPulse = mutableListOf<Int>() // Track which lines are being cleared
|
||||||
|
|
||||||
|
private val ghostPaint = Paint().apply {
|
||||||
|
style = Paint.Style.STROKE
|
||||||
|
strokeWidth = 2f
|
||||||
|
color = Color.WHITE
|
||||||
|
alpha = 180 // Increased from 100 for better visibility
|
||||||
|
}
|
||||||
|
|
||||||
|
private val ghostBackgroundPaint = Paint().apply {
|
||||||
|
style = Paint.Style.FILL
|
||||||
|
color = Color.WHITE
|
||||||
|
alpha = 30 // Very light background for better contrast
|
||||||
|
}
|
||||||
|
|
||||||
|
private val ghostBorderPaint = Paint().apply {
|
||||||
|
style = Paint.Style.STROKE
|
||||||
|
strokeWidth = 1f
|
||||||
|
color = Color.WHITE
|
||||||
|
alpha = 100 // Subtle border for better definition
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
// Start with paused state
|
// Start with paused state
|
||||||
pause()
|
pause()
|
||||||
|
@ -578,15 +598,43 @@ class GameView @JvmOverloads constructor(
|
||||||
val piece = gameBoard.getCurrentPiece() ?: return
|
val piece = gameBoard.getCurrentPiece() ?: return
|
||||||
val ghostY = gameBoard.getGhostY()
|
val ghostY = gameBoard.getGhostY()
|
||||||
|
|
||||||
|
// Draw semi-transparent background for each block
|
||||||
for (y in 0 until piece.getHeight()) {
|
for (y in 0 until piece.getHeight()) {
|
||||||
for (x in 0 until piece.getWidth()) {
|
for (x in 0 until piece.getWidth()) {
|
||||||
if (piece.isBlockAt(x, y)) {
|
if (piece.isBlockAt(x, y)) {
|
||||||
val boardX = piece.x + x
|
val boardX = piece.x + x
|
||||||
val boardY = ghostY + y
|
val boardY = ghostY + y
|
||||||
|
|
||||||
// Draw ghost piece regardless of vertical position
|
|
||||||
if (boardX >= 0 && boardX < gameBoard.width) {
|
if (boardX >= 0 && boardX < gameBoard.width) {
|
||||||
drawBlock(canvas, boardX, boardY, true, false)
|
val screenX = boardLeft + boardX * blockSize
|
||||||
|
val screenY = boardTop + boardY * blockSize
|
||||||
|
|
||||||
|
// Draw background
|
||||||
|
canvas.drawRect(
|
||||||
|
screenX + 1f,
|
||||||
|
screenY + 1f,
|
||||||
|
screenX + blockSize - 1f,
|
||||||
|
screenY + blockSize - 1f,
|
||||||
|
ghostBackgroundPaint
|
||||||
|
)
|
||||||
|
|
||||||
|
// Draw border
|
||||||
|
canvas.drawRect(
|
||||||
|
screenX + 1f,
|
||||||
|
screenY + 1f,
|
||||||
|
screenX + blockSize - 1f,
|
||||||
|
screenY + blockSize - 1f,
|
||||||
|
ghostBorderPaint
|
||||||
|
)
|
||||||
|
|
||||||
|
// Draw outline
|
||||||
|
canvas.drawRect(
|
||||||
|
screenX + 1f,
|
||||||
|
screenY + 1f,
|
||||||
|
screenX + blockSize - 1f,
|
||||||
|
screenY + blockSize - 1f,
|
||||||
|
ghostPaint
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue