mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-14 07:36:06 +09:00
y u wont render :(
This commit is contained in:
@@ -241,10 +241,7 @@ class UIItemTextLineInput(
|
||||
if (!maxLen.exceeds(textbuf, codepoints)) {
|
||||
textbuf.addAll(cursorX, codepoints)
|
||||
|
||||
cursorX += codepoints.size
|
||||
cursorDrawX = App.fontGame.getWidth(CodepointSequence(textbuf.subList(0, cursorX)))
|
||||
|
||||
tryCursorBack()
|
||||
moveCursorToEnd(codepoints.size)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -320,10 +317,7 @@ class UIItemTextLineInput(
|
||||
if (!maxLen.exceeds(textbuf, codepoints)) {
|
||||
textbuf.addAll(cursorX, codepoints)
|
||||
|
||||
cursorX += codepoints.size
|
||||
cursorDrawX = App.fontGame.getWidth(CodepointSequence(textbuf.subList(0, cursorX)))
|
||||
|
||||
tryCursorBack()
|
||||
moveCursorToEnd(codepoints.size)
|
||||
}
|
||||
}
|
||||
else if (keycodes.containsSome(Input.Keys.ENTER, Input.Keys.NUMPAD_ENTER)) {
|
||||
@@ -423,10 +417,7 @@ class UIItemTextLineInput(
|
||||
|
||||
actuallyInserted.removeAt(0)
|
||||
|
||||
textbuf.addAll(cursorX, actuallyInserted)
|
||||
|
||||
cursorX += actuallyInserted.size
|
||||
cursorDrawX = App.fontGame.getWidth(CodepointSequence(textbuf.subList(0, cursorX)))
|
||||
moveCursorToEnd(actuallyInserted.size)
|
||||
|
||||
tryCursorBack()
|
||||
|
||||
@@ -441,6 +432,13 @@ class UIItemTextLineInput(
|
||||
return textbuf.toJavaString()
|
||||
}
|
||||
|
||||
private fun moveCursorToEnd(stride: Int) {
|
||||
cursorX += stride
|
||||
cursorDrawX = App.fontGame.getWidth(CodepointSequence(textbuf.subList(0, cursorX)))
|
||||
|
||||
tryCursorBack()
|
||||
}
|
||||
|
||||
override fun render(batch: SpriteBatch, camera: Camera) {
|
||||
|
||||
val ime = getIME(true)
|
||||
@@ -609,10 +607,12 @@ class UIItemTextLineInput(
|
||||
}
|
||||
fun setText(s: String) {
|
||||
clearText()
|
||||
textbuf.addAll(s.toCodePoints())
|
||||
appendText(s)
|
||||
}
|
||||
fun appendText(s: String) {
|
||||
textbuf.addAll(s.toCodePoints())
|
||||
val c = s.toCodePoints()
|
||||
textbuf.addAll(c)
|
||||
moveCursorToEnd(c.size)
|
||||
}
|
||||
override fun dispose() {
|
||||
fbo.dispose()
|
||||
|
||||
Reference in New Issue
Block a user