mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-16 00:26:07 +09:00
resolution input will have red text if the text format is invalid
This commit is contained in:
@@ -78,12 +78,13 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
||||
(it as UIItemTextLineInput).textCommitListener = { text ->
|
||||
val text = text.lowercase()
|
||||
if (text.matches(Regex("""[0-9]+x[0-9]+"""))) {
|
||||
it.markAsNormal()
|
||||
val width = text.substringBefore('x').toInt()
|
||||
val height = text.substringAfter('x').toInt()
|
||||
App.setConfig(keyWidth, width)
|
||||
App.setConfig(keyHeight, height)
|
||||
}
|
||||
// else it.markAsInvalid
|
||||
else it.markAsInvalid()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user