From 7cdc9988cb2042cddaf85e5d1e7f359663454157 Mon Sep 17 00:00:00 2001 From: cmclark00 Date: Fri, 28 Mar 2025 20:17:44 -0400 Subject: [PATCH] fix: enhance block skins to match their respective themes - Classic: Clean white blocks with subtle glow - Neon: Strong glow effects with magenta colors - Retro: Pixelated look with highlights and shadows - Minimalist: Clean black blocks with subtle borders - Galaxy: Cosmic effects with gradient and sparkles --- .../main/java/com/mintris/game/GameView.kt | 194 +++++++++++++----- 1 file changed, 137 insertions(+), 57 deletions(-) diff --git a/app/src/main/java/com/mintris/game/GameView.kt b/app/src/main/java/com/mintris/game/GameView.kt index e296d14..e4d7625 100644 --- a/app/src/main/java/com/mintris/game/GameView.kt +++ b/app/src/main/java/com/mintris/game/GameView.kt @@ -2,12 +2,14 @@ package com.mintris.game import android.animation.ValueAnimator import android.content.Context +import android.graphics.BlurMaskFilter import android.graphics.Canvas import android.graphics.Color +import android.graphics.LinearGradient import android.graphics.Paint import android.graphics.Rect import android.graphics.RectF -import android.graphics.BlurMaskFilter +import android.graphics.Shader import android.os.Build import android.os.Handler import android.os.Looper @@ -236,6 +238,7 @@ class GameView @JvmOverloads constructor( blockSkinPaints["block_skin_1"] = Paint().apply { color = Color.WHITE isAntiAlias = true + style = Paint.Style.FILL } // Neon skin @@ -248,9 +251,8 @@ class GameView @JvmOverloads constructor( // Retro skin blockSkinPaints["block_skin_3"] = Paint().apply { color = Color.parseColor("#FF5A5F") - isAntiAlias = true - style = Paint.Style.STROKE - strokeWidth = 2f + isAntiAlias = false // Pixelated look + style = Paint.Style.FILL } // Minimalist skin @@ -601,61 +603,139 @@ class GameView @JvmOverloads constructor( // Create a clone of the paint to avoid modifying the original val blockPaint = Paint(paint) - // Special handling for neon skin - if (currentBlockSkin == "block_skin_2") { - // Stronger outer glow for neon skin - blockGlowPaint.color = if (isGhost) Color.argb(30, 255, 0, 255) else Color.parseColor("#FF00FF") - blockGlowPaint.maskFilter = BlurMaskFilter(16f, BlurMaskFilter.Blur.OUTER) - canvas.drawRect(left - 4f, top - 4f, right + 4f, bottom + 4f, blockGlowPaint) - - // For neon, use semi-translucent fill with strong glowing edges - blockPaint.style = Paint.Style.FILL_AND_STROKE - blockPaint.strokeWidth = 2f - blockPaint.maskFilter = BlurMaskFilter(8f, BlurMaskFilter.Blur.NORMAL) - - if (isGhost) { - blockPaint.color = Color.argb(30, 255, 0, 255) - blockPaint.alpha = 30 - } else { - blockPaint.color = Color.parseColor("#66004D") // Darker magenta fill - blockPaint.alpha = 170 // More opaque to be more visible + // Draw block based on current skin + when (currentBlockSkin) { + "block_skin_1" -> { // Classic + // Draw outer glow + blockGlowPaint.color = if (isGhost) Color.argb(30, 255, 255, 255) else Color.WHITE + canvas.drawRect(left - 2f, top - 2f, right + 2f, bottom + 2f, blockGlowPaint) + + // Draw block + blockPaint.color = if (isGhost) Color.argb(30, 255, 255, 255) else Color.WHITE + blockPaint.alpha = if (isGhost) 30 else 255 + canvas.drawRect(left, top, right, bottom, blockPaint) + + // Draw inner glow + glowPaint.color = if (isGhost) Color.argb(30, 255, 255, 255) else Color.WHITE + canvas.drawRect(left + 1f, top + 1f, right - 1f, bottom - 1f, glowPaint) } - - // Draw block with neon effect - canvas.drawRect(left, top, right, bottom, blockPaint) - - // Draw a brighter border for better visibility - val borderPaint = Paint().apply { - color = Color.parseColor("#FF00FF") - style = Paint.Style.STROKE - strokeWidth = 3f - alpha = 255 - isAntiAlias = true - maskFilter = BlurMaskFilter(6f, BlurMaskFilter.Blur.NORMAL) + "block_skin_2" -> { // Neon + // Stronger outer glow for neon skin + blockGlowPaint.color = if (isGhost) Color.argb(30, 255, 0, 255) else Color.parseColor("#FF00FF") + blockGlowPaint.maskFilter = BlurMaskFilter(16f, BlurMaskFilter.Blur.OUTER) + canvas.drawRect(left - 4f, top - 4f, right + 4f, bottom + 4f, blockGlowPaint) + + // For neon, use semi-translucent fill with strong glowing edges + blockPaint.style = Paint.Style.FILL_AND_STROKE + blockPaint.strokeWidth = 2f + blockPaint.maskFilter = BlurMaskFilter(8f, BlurMaskFilter.Blur.NORMAL) + + if (isGhost) { + blockPaint.color = Color.argb(30, 255, 0, 255) + blockPaint.alpha = 30 + } else { + blockPaint.color = Color.parseColor("#66004D") // Darker magenta fill + blockPaint.alpha = 170 // More opaque to be more visible + } + + // Draw block with neon effect + canvas.drawRect(left, top, right, bottom, blockPaint) + + // Draw a brighter border for better visibility + val borderPaint = Paint().apply { + color = Color.parseColor("#FF00FF") + style = Paint.Style.STROKE + strokeWidth = 3f + alpha = 255 + isAntiAlias = true + maskFilter = BlurMaskFilter(6f, BlurMaskFilter.Blur.NORMAL) + } + canvas.drawRect(left, top, right, bottom, borderPaint) + + // Inner glow for neon blocks + glowPaint.color = if (isGhost) Color.argb(10, 255, 0, 255) else Color.parseColor("#FF00FF") + glowPaint.alpha = if (isGhost) 10 else 100 + glowPaint.style = Paint.Style.STROKE + glowPaint.strokeWidth = 2f + glowPaint.maskFilter = BlurMaskFilter(4f, BlurMaskFilter.Blur.NORMAL) + canvas.drawRect(left + 4f, top + 4f, right - 4f, bottom - 4f, glowPaint) + } + "block_skin_3" -> { // Retro + // Draw pixelated block with retro effect + blockPaint.color = if (isGhost) Color.argb(30, 255, 90, 95) else Color.parseColor("#FF5A5F") + blockPaint.alpha = if (isGhost) 30 else 255 + + // Draw main block + canvas.drawRect(left, top, right, bottom, blockPaint) + + // Draw pixelated highlights + val highlightPaint = Paint().apply { + color = Color.parseColor("#FF8A8F") + isAntiAlias = false + style = Paint.Style.FILL + } + // Top and left highlights + canvas.drawRect(left, top, right - 2f, top + 2f, highlightPaint) + canvas.drawRect(left, top, left + 2f, bottom - 2f, highlightPaint) + + // Draw pixelated shadows + val shadowPaint = Paint().apply { + color = Color.parseColor("#CC4A4F") + isAntiAlias = false + style = Paint.Style.FILL + } + // Bottom and right shadows + canvas.drawRect(left + 2f, bottom - 2f, right, bottom, shadowPaint) + canvas.drawRect(right - 2f, top + 2f, right, bottom - 2f, shadowPaint) + } + "block_skin_4" -> { // Minimalist + // Draw clean, simple block with subtle border + blockPaint.color = if (isGhost) Color.argb(30, 0, 0, 0) else Color.BLACK + blockPaint.alpha = if (isGhost) 30 else 255 + blockPaint.style = Paint.Style.FILL + canvas.drawRect(left, top, right, bottom, blockPaint) + + // Draw subtle border + val borderPaint = Paint().apply { + color = Color.parseColor("#333333") + style = Paint.Style.STROKE + strokeWidth = 1f + isAntiAlias = true + } + canvas.drawRect(left, top, right, bottom, borderPaint) + } + "block_skin_5" -> { // Galaxy + // Draw cosmic glow effect + blockGlowPaint.color = if (isGhost) Color.argb(30, 102, 252, 241) else Color.parseColor("#66FCF1") + blockGlowPaint.maskFilter = BlurMaskFilter(20f, BlurMaskFilter.Blur.OUTER) + canvas.drawRect(left - 8f, top - 8f, right + 8f, bottom + 8f, blockGlowPaint) + + // Draw main block with gradient + val gradient = LinearGradient( + left, top, right, bottom, + Color.parseColor("#66FCF1"), + Color.parseColor("#45B7AF"), + Shader.TileMode.CLAMP + ) + blockPaint.shader = gradient + blockPaint.color = if (isGhost) Color.argb(30, 102, 252, 241) else Color.parseColor("#66FCF1") + blockPaint.alpha = if (isGhost) 30 else 255 + blockPaint.style = Paint.Style.FILL + canvas.drawRect(left, top, right, bottom, blockPaint) + + // Draw star-like sparkles + if (!isGhost) { + val sparklePaint = Paint().apply { + color = Color.WHITE + style = Paint.Style.FILL + isAntiAlias = true + maskFilter = BlurMaskFilter(4f, BlurMaskFilter.Blur.NORMAL) + } + // Add small white dots for sparkle effect + canvas.drawCircle(left + 4f, top + 4f, 1f, sparklePaint) + canvas.drawCircle(right - 4f, bottom - 4f, 1f, sparklePaint) + } } - canvas.drawRect(left, top, right, bottom, borderPaint) - - // Inner glow for neon blocks - brighter than before - glowPaint.color = if (isGhost) Color.argb(10, 255, 0, 255) else Color.parseColor("#FF00FF") - glowPaint.alpha = if (isGhost) 10 else 100 // More visible inner glow - glowPaint.style = Paint.Style.STROKE - glowPaint.strokeWidth = 2f - glowPaint.maskFilter = BlurMaskFilter(4f, BlurMaskFilter.Blur.NORMAL) - canvas.drawRect(left + 4f, top + 4f, right - 4f, bottom - 4f, glowPaint) - } else { - // Standard rendering for other skins - // Draw outer glow - blockGlowPaint.color = if (isGhost) Color.argb(30, 255, 255, 255) else Color.WHITE - canvas.drawRect(left - 2f, top - 2f, right + 2f, bottom + 2f, blockGlowPaint) - - // Draw block with current skin - blockPaint.color = if (isGhost) Color.argb(30, 255, 255, 255) else blockPaint.color - blockPaint.alpha = if (isGhost) 30 else 255 - canvas.drawRect(left, top, right, bottom, blockPaint) - - // Draw inner glow - glowPaint.color = if (isGhost) Color.argb(30, 255, 255, 255) else Color.WHITE - canvas.drawRect(left + 1f, top + 1f, right - 1f, bottom - 1f, glowPaint) } // Draw pulse effect if animation is active and this is a pulsing line