From 03ff049bef15a1ef0bdf1d6b0ac551ac5563cf19 Mon Sep 17 00:00:00 2001 From: cmclark00 Date: Sun, 30 Mar 2025 15:54:36 -0400 Subject: [PATCH] feat: improve ghost piece visibility with three-layer design for better accessibility --- .../main/java/com/mintris/game/GameView.kt | 52 ++++++++++++++++++- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/mintris/game/GameView.kt b/app/src/main/java/com/mintris/game/GameView.kt index fd20729..27e38a0 100644 --- a/app/src/main/java/com/mintris/game/GameView.kt +++ b/app/src/main/java/com/mintris/game/GameView.kt @@ -179,6 +179,26 @@ class GameView @JvmOverloads constructor( private var isPulsing = false private var linesToPulse = mutableListOf() // 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 { // Start with paused state pause() @@ -578,15 +598,43 @@ class GameView @JvmOverloads constructor( val piece = gameBoard.getCurrentPiece() ?: return val ghostY = gameBoard.getGhostY() + // Draw semi-transparent background for each block for (y in 0 until piece.getHeight()) { for (x in 0 until piece.getWidth()) { if (piece.isBlockAt(x, y)) { val boardX = piece.x + x val boardY = ghostY + y - // Draw ghost piece regardless of vertical position 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 + ) } } }