commonMain.graphics.Font.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of konapi-jvm Show documentation
Show all versions of konapi-jvm Show documentation
Kotlin Native for Raspberry Pi
The newest version!
package ch.softappeal.konapi.graphics
public val FONT_CHARS: CharRange = ' '..'~'
public fun Graphics.draw(xTopLeft: Int, yTopLeft: Int, ch: Char) {
font.draw(this, xTopLeft, yTopLeft, ch - FONT_CHARS.first)
}
public fun Graphics.draw(topLeft: Point, ch: Char) {
draw(topLeft.x, topLeft.y, ch)
}
public fun Graphics.draw(xTopLeft: Int, yTopLeft: Int, string: String) {
var x = xTopLeft
for (ch in string) {
draw(x, yTopLeft, ch)
x += font.width
}
}
public fun Graphics.draw(topLeft: Point, string: String) {
draw(topLeft.x, topLeft.y, string)
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy