mirror of
https://github.com/cmclark00/mintris.git
synced 2025-05-18 07:45:21 +01:00
fixed HS on title
This commit is contained in:
parent
ee2bb0883a
commit
d2554d5dfc
2 changed files with 14 additions and 5 deletions
|
@ -346,6 +346,7 @@ class MainActivity : AppCompatActivity() {
|
||||||
gameStartTime = System.currentTimeMillis()
|
gameStartTime = System.currentTimeMillis()
|
||||||
piecesPlaced = 0
|
piecesPlaced = 0
|
||||||
statsManager.startNewSession()
|
statsManager.startNewSession()
|
||||||
|
gameBoard.updateLevel(selectedLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun restartGame() {
|
private fun restartGame() {
|
||||||
|
|
|
@ -126,9 +126,9 @@ class TitleScreen @JvmOverloads constructor(
|
||||||
// High scores text settings
|
// High scores text settings
|
||||||
highScorePaint.apply {
|
highScorePaint.apply {
|
||||||
color = Color.WHITE
|
color = Color.WHITE
|
||||||
textSize = 35f
|
textSize = 70f
|
||||||
textAlign = Paint.Align.CENTER
|
textAlign = Paint.Align.LEFT // Changed to LEFT alignment
|
||||||
typeface = Typeface.create(Typeface.SANS_SERIF, Typeface.NORMAL)
|
typeface = Typeface.create(Typeface.MONOSPACE, Typeface.NORMAL) // Changed to monospace
|
||||||
isAntiAlias = true
|
isAntiAlias = true
|
||||||
alpha = 200
|
alpha = 200
|
||||||
}
|
}
|
||||||
|
@ -241,9 +241,17 @@ class TitleScreen @JvmOverloads constructor(
|
||||||
val highScores: List<HighScore> = highScoreManager.getHighScores()
|
val highScores: List<HighScore> = highScoreManager.getHighScores()
|
||||||
val highScoreY = height * 0.5f
|
val highScoreY = height * 0.5f
|
||||||
if (highScores.isNotEmpty()) {
|
if (highScores.isNotEmpty()) {
|
||||||
|
// Calculate the starting X position to center the entire block of scores
|
||||||
|
val maxScoreWidth = highScorePaint.measureText("99. PLAYER: 999999")
|
||||||
|
val startX = (width - maxScoreWidth) / 2
|
||||||
|
|
||||||
highScores.forEachIndexed { index: Int, score: HighScore ->
|
highScores.forEachIndexed { index: Int, score: HighScore ->
|
||||||
val y = highScoreY + (index * 35f)
|
val y = highScoreY + (index * 80f)
|
||||||
canvas.drawText("${index + 1}. ${score.name}: ${score.score}", width / 2f, y, highScorePaint)
|
// Pad the rank number to ensure alignment
|
||||||
|
val rank = (index + 1).toString().padStart(2, ' ')
|
||||||
|
// Pad the name to ensure score alignment
|
||||||
|
val paddedName = score.name.padEnd(8, ' ')
|
||||||
|
canvas.drawText("$rank. $paddedName ${score.score}", startX, y, highScorePaint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue