The 2048 Game tutorial shows
text("0", cellSize * 0.5, Colors.WHITE, font) {
setTextBounds(Rectangle(0.0, 0.0, bgScore.width, cellSize - 24.0))
format = format.copy(align = Html.Alignment.MIDDLE_CENTER) // there is an error
centerXOn(bgScore)
alignTopToTopOf(bgScore, 12.0)
}
I use android studio 4.1 and Korge plugin 1.12.2.2. The IDE shows: Unresolved reference.
I change this line to
setFormat(align = TextAlignment.MIDDLE_CENTER)
The error of IDE disappear, but the text don't show either.
How to fix it, and set the text in the middle of the object of bgScore
Thanks a lot
The korge in new version
text("0", cellSize * 0.5, Colors.WHITE, font) {
setTextBounds(Rectangle(0.0, 0.0, bgScore.width, cellSize - 24.0))
// format = format.copy(align = Html.Alignment.MIDDLE_CENTER) // there is an error
alignment = TextAlignment.MIDDLE_CENTER // it works in version korGE 2.0
centerXOn(bgScore)
alignTopToTopOf(bgScore, 12.0)
}