Skip to content

Instantly share code, notes, and snippets.

@IvanShafran
Created January 3, 2022 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IvanShafran/8d2b20a572e9f82498b80fff49c17447 to your computer and use it in GitHub Desktop.
Save IvanShafran/8d2b20a572e9f82498b80fff49c17447 to your computer and use it in GitHub Desktop.
private val scorePaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
color = Color.GREEN
textSize = context.resources.getDimension(R.dimen.score_size)
}
private var score: Int = 0
private var scorePoint = PointF()
private fun initializeScore() {
val bounds = Rect()
scorePaint.getTextBounds("0", 0, 1, bounds)
val scoreMargin = resources.getDimension(R.dimen.score_margin)
scorePoint = PointF(width / 2f, scoreMargin + bounds.height())
score = 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment