mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-07 20:01:52 +09:00
color code utils; colour-coded sample text
This commit is contained in:
BIN
font_test_3.PNG
BIN
font_test_3.PNG
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 67 KiB |
@@ -748,6 +748,10 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
else throw IllegalArgumentException("Font scale cannot be zero or negative (input: $value)")
|
||||
}
|
||||
|
||||
fun toColorCode(rgba4444: Int): String = GameFontBase.toColorCode(rgba4444)
|
||||
fun toColorCode(r: Int, g: Int, b: Int, a: Int = 0x0F): String = toColorCode(r.shl(12) or g.shl(8) or b.shl(4) or a)
|
||||
val noColorCode = toColorCode(0x0000)
|
||||
|
||||
companion object {
|
||||
internal val JUNG_COUNT = 21
|
||||
internal val JONG_COUNT = 28
|
||||
@@ -785,6 +789,13 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
internal val SHEET_CUSTOM_SYM = 16
|
||||
|
||||
internal val SHEET_UNKNOWN = 254
|
||||
|
||||
|
||||
fun toColorCode(rgba4444: Int): String = Character.toChars(0x100000 + rgba4444).toColCode()
|
||||
fun toColorCode(r: Int, g: Int, b: Int, a: Int = 0x0F): String = toColorCode(r.shl(12) or g.shl(8) or b.shl(4) or a)
|
||||
private fun CharArray.toColCode(): String = "${this[0]}${this[1]}"
|
||||
|
||||
val noColorCode = toColorCode(0x0000)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -753,5 +753,15 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
|
||||
else throw IllegalArgumentException("Font scale cannot be zero or negative (input: $value)")
|
||||
}
|
||||
|
||||
fun toColorCode(rgba4444: Int): String = GameFontBase.toColorCode(rgba4444)
|
||||
fun toColorCode(r: Int, g: Int, b: Int, a: Int = 0x0F): String = toColorCode(r.shl(12) or g.shl(8) or b.shl(4) or a)
|
||||
val noColorCode = toColorCode(0x0000)
|
||||
|
||||
companion object {
|
||||
fun toColorCode(rgba4444: Int): String = Character.toChars(0x100000 + rgba4444).toColCode()
|
||||
fun toColorCode(r: Int, g: Int, b: Int, a: Int = 0x0F): String = toColorCode(r.shl(12) or g.shl(8) or b.shl(4) or a)
|
||||
private fun CharArray.toColCode(): String = "${this[0]}${this[1]}"
|
||||
|
||||
val noColorCode = toColorCode(0x0000)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user