Fix title text: make lowercase and correct overlapping issue

This commit is contained in:
cmclark00 2025-04-01 23:55:09 -04:00
parent ff1a0edd2f
commit fbecf256a2

View file

@ -240,24 +240,30 @@ class TitleScreen @JvmOverloads constructor(
// Draw title with "Mint" in mint color // Draw title with "Mint" in mint color
val titleY = height * 0.4f val titleY = height * 0.4f
val fullTitle = "Pixel Mint Drop" val fullTitle = "pixel mint drop"
val pixelWidth = titlePaint.measureText("Pixel ") val pixelWidth = titlePaint.measureText("pixel ")
val mintWidth = titlePaint.measureText("Mint") val mintWidth = titlePaint.measureText("mint")
val dropWidth = titlePaint.measureText(" Drop") val dropWidth = titlePaint.measureText(" drop")
// Draw "Pixel" in theme color // Calculate total width
canvas.drawText("Pixel ", width / 2f - (mintWidth + dropWidth) / 2, titleY, titlePaint) val totalWidth = pixelWidth + mintWidth + dropWidth
// Start position for "pixel"
val startX = width / 2f - totalWidth / 2
// Draw "pixel" in theme color
canvas.drawText("pixel ", startX, titleY, titlePaint)
// Save the original color // Save the original color
val originalColor = titlePaint.color val originalColor = titlePaint.color
// Draw "Mint" in mint color (#3EB489) // Draw "mint" in mint color (#3EB489)
titlePaint.color = Color.parseColor("#3EB489") titlePaint.color = Color.parseColor("#3EB489")
canvas.drawText("Mint", width / 2f - (dropWidth) / 2, titleY, titlePaint) canvas.drawText("mint", startX + pixelWidth, titleY, titlePaint)
// Restore the original color and draw "Drop" // Restore the original color and draw "drop"
titlePaint.color = originalColor titlePaint.color = originalColor
canvas.drawText(" Drop", width / 2f + (mintWidth) / 2, titleY, titlePaint) canvas.drawText(" drop", startX + pixelWidth + mintWidth, titleY, titlePaint)
// Draw high scores using pre-allocated manager // Draw high scores using pre-allocated manager
val highScores: List<HighScore> = highScoreManager.getHighScores() val highScores: List<HighScore> = highScoreManager.getHighScores()