mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 04:54:05 +09:00
Fix on fonts, fixed special char printing (>=0x80) on Term, essentially changing encoding from UTF-8 to ISO-8859-1
Former-commit-id: 78d4423e896301aebdec2f27893bb2aefaf4aada Former-commit-id: e317df0eca8da1598159648bc44c30b86663d8a5
This commit is contained in:
@@ -93,6 +93,7 @@ open class SimpleTextTerminal(
|
||||
open protected val colourScreen = if (colour) Color(4, 4, 4) else Color(19, 19, 19)
|
||||
|
||||
|
||||
|
||||
override fun getColor(index: Int): Color = colours[index]
|
||||
|
||||
override fun update(gc: GameContainer, delta: Int) {
|
||||
@@ -191,14 +192,14 @@ open class SimpleTextTerminal(
|
||||
|
||||
/** Emits a bufferChar. Does not move cursor
|
||||
* It is also not affected by the control sequences; just print them out as symbol */
|
||||
override fun emitChar(bufferChar: Int) {
|
||||
screenBuffer.drawBuffer(cursorX, cursorY, bufferChar.toChar())
|
||||
override fun emitChar(bufferChar: Int, x: Int, y: Int) {
|
||||
screenBuffer.drawBuffer(x, y, bufferChar.toChar())
|
||||
}
|
||||
|
||||
/** Emits a char. Does not move cursor
|
||||
* It is also not affected by the control sequences; just print them out as symbol */
|
||||
override fun emitChar(c: Char) {
|
||||
screenBuffer.drawBuffer(cursorX, cursorY, c.toInt().and(0xFF).toChar(), colourKey)
|
||||
override fun emitChar(c: Char, x: Int, y: Int) {
|
||||
screenBuffer.drawBuffer(x, y, c.toInt().and(0xFF).toChar(), colourKey)
|
||||
}
|
||||
|
||||
/** Prints a char and move cursor accordingly. */
|
||||
@@ -244,18 +245,21 @@ open class SimpleTextTerminal(
|
||||
/** Emits a string and move cursor accordingly. */
|
||||
override fun writeString(s: String, x: Int, y: Int) {
|
||||
setCursor(x, y)
|
||||
emitString(s)
|
||||
val absCursorPos = cursorX + cursorY * width + s.length
|
||||
setCursor(absCursorPos % width, absCursorPos / width)
|
||||
|
||||
for (i in 0..s.length - 1) {
|
||||
printChar(s[i])
|
||||
wrap()
|
||||
}
|
||||
}
|
||||
|
||||
/** Emits a string. Does not move cursor */
|
||||
override fun emitString(s: String) {
|
||||
val x = cursorX
|
||||
val y = cursorY
|
||||
/** Emits a string, does not affected by control sequences. Does not move cursor */
|
||||
override fun emitString(s: String, x: Int, y: Int) {
|
||||
setCursor(x, y)
|
||||
|
||||
for (i in 0..s.length - 1)
|
||||
printChar(s[i])
|
||||
for (i in 0..s.length - 1) {
|
||||
emitChar(s[i])
|
||||
wrap()
|
||||
}
|
||||
|
||||
setCursor(x, y)
|
||||
}
|
||||
|
||||
@@ -39,14 +39,14 @@ interface Terminal : Teletype {
|
||||
fun setCursor(x: Int, y: Int)
|
||||
/** Emits a bufferChar. Does not move cursor
|
||||
* It is also not affected by the control sequences; just print them out as symbol */
|
||||
fun emitChar(bufferChar: Int)
|
||||
fun emitChar(bufferChar: Int, x: Int = cursorX, y: Int = cursorY)
|
||||
/** Emits a char. Does not move cursor
|
||||
* It is also not affected by the control sequences; just print them out as symbol */
|
||||
fun emitChar(c: Char)
|
||||
fun emitChar(c: Char, x: Int = cursorX, y: Int = cursorY)
|
||||
/** Prints a char and move cursor accordingly. */
|
||||
override fun printChar(c: Char)
|
||||
/** Emits a string. Does not move cursor */
|
||||
fun emitString(s: String)
|
||||
/** Emits a string, does not affected by control sequences. Does not move cursor */
|
||||
fun emitString(s: String, x: Int = cursorX, y: Int = cursorY)
|
||||
/** Emits a string and move cursor accordingly, then do LF */
|
||||
fun printString(s: String, x: Int = cursorX, y: Int = cursorY)
|
||||
/** Emits a string and move cursor accordingly. */
|
||||
|
||||
Reference in New Issue
Block a user