mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
some ui updates
This commit is contained in:
@@ -33,7 +33,11 @@
|
|||||||
"MENU_OPTIONS_JVM_HEAP_MAX": "Max JVM Heap Memory",
|
"MENU_OPTIONS_JVM_HEAP_MAX": "Max JVM Heap Memory",
|
||||||
"MENU_OPTIONS_AUTOSAVE": "Autosave",
|
"MENU_OPTIONS_AUTOSAVE": "Autosave",
|
||||||
"CONTEXT_TIME_MINUTE_PLURAL": "Minutes",
|
"CONTEXT_TIME_MINUTE_PLURAL": "Minutes",
|
||||||
|
"CONTEXT_TIME_SECOND_PLURAL": "Seconds",
|
||||||
"MENU_LABEL_SYSTEM_INFO": "System Info",
|
"MENU_LABEL_SYSTEM_INFO": "System Info",
|
||||||
|
"MENU_OPTIONS_NOTIFICATION_DISPLAY_DURATION": "Show notification for",
|
||||||
|
"MENU_LABEL_STREAMING": "Livestreaming",
|
||||||
|
"MENU_LABEL_EXTRA_JVM_ARGUMENTS": "Extra JVM Arguments",
|
||||||
"GAME_PREV_SAVE_WAS_LOADED": "The most recently saved game was corrupted.\nThe previously saved game was loaded.",
|
"GAME_PREV_SAVE_WAS_LOADED": "The most recently saved game was corrupted.\nThe previously saved game was loaded.",
|
||||||
"GAME_MORE_RECENT_AUTOSAVE1": "The Autosave is more recent than the manual save.",
|
"GAME_MORE_RECENT_AUTOSAVE1": "The Autosave is more recent than the manual save.",
|
||||||
"GAME_MORE_RECENT_AUTOSAVE2": "Please select the saved game you want to load:"
|
"GAME_MORE_RECENT_AUTOSAVE2": "Please select the saved game you want to load:"
|
||||||
|
|||||||
@@ -30,5 +30,8 @@
|
|||||||
"MENU_OPTIONS_JVM_HEAP_MAX": "최대 JVM 힙 메모리",
|
"MENU_OPTIONS_JVM_HEAP_MAX": "최대 JVM 힙 메모리",
|
||||||
"MENU_OPTIONS_AUTOSAVE": "자동 저장",
|
"MENU_OPTIONS_AUTOSAVE": "자동 저장",
|
||||||
"CONTEXT_TIME_MINUTE_PLURAL": "분",
|
"CONTEXT_TIME_MINUTE_PLURAL": "분",
|
||||||
"MENU_LABEL_SYSTEM_INFO": "시스템 정보"
|
"CONTEXT_TIME_SECOND_PLURAL": "초",
|
||||||
|
"MENU_LABEL_SYSTEM_INFO": "시스템 정보",
|
||||||
|
"MENU_OPTIONS_NOTIFICATION_DISPLAY_DURATION": "알림 표시 시간",
|
||||||
|
"MENU_LABEL_STREAMING": "실시간 방송"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ object DefaultConfig {
|
|||||||
|
|
||||||
val hashMap = hashMapOf<String, Any>(
|
val hashMap = hashMapOf<String, Any>(
|
||||||
"jvm_xmx" to 8,
|
"jvm_xmx" to 8,
|
||||||
|
"jvm_extra_cmd" to "",
|
||||||
"displayfps" to 0, // 0: no limit, non-zero: limit
|
"displayfps" to 0, // 0: no limit, non-zero: limit
|
||||||
"displayfpsidle" to 0, // 0: no limit, non-zero: limit
|
"displayfpsidle" to 0, // 0: no limit, non-zero: limit
|
||||||
"displaycolourdepth" to 8,
|
"displaycolourdepth" to 8,
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Bootstrapper that launches the bundled JVM and injects VM configs such as -Xmx
|
||||||
|
*
|
||||||
* Created by minjaesong on 2023-06-22.
|
* Created by minjaesong on 2023-06-22.
|
||||||
*/
|
*/
|
||||||
public class Principii {
|
public class Principii {
|
||||||
@@ -100,11 +102,13 @@ public class Principii {
|
|||||||
|
|
||||||
|
|
||||||
int xmx = getConfigInt("jvm_xmx");
|
int xmx = getConfigInt("jvm_xmx");
|
||||||
|
String userDefinedExtraCmd = getConfigString("jvm_extra_cmd").trim();
|
||||||
|
if (!userDefinedExtraCmd.isEmpty()) userDefinedExtraCmd = " "+userDefinedExtraCmd;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String[] cmd = (runtime+extracmd+" -Xms1G -Xmx"+xmx+"G -cp ./out/TerrarumBuild.jar net.torvald.terrarum.App").split(" ");
|
String[] cmd = (runtime+extracmd+userDefinedExtraCmd+" -Xms1G -Xmx"+xmx+"G -cp ./out/TerrarumBuild.jar net.torvald.terrarum.App").split(" ");
|
||||||
ProcessBuilder pb = new ProcessBuilder(cmd);
|
ProcessBuilder pb = new ProcessBuilder(cmd);
|
||||||
pb.inheritIO();
|
pb.inheritIO();
|
||||||
System.exit(pb.start().waitFor());
|
System.exit(pb.start().waitFor());
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
private val h1MarginBottom = 4
|
private val h1MarginBottom = 4
|
||||||
|
|
||||||
private val options = arrayOf(
|
private val options = arrayOf(
|
||||||
arrayOf("", { Lang["MENU_OPTIONS_PERFORMANCE"] }, "h1"),
|
arrayOf("", { Lang["CREDITS_VFX"] }, "h1"),
|
||||||
arrayOf("fx_dither", { Lang["MENU_OPTIONS_DITHER"] }, "toggle"),
|
arrayOf("fx_dither", { Lang["MENU_OPTIONS_DITHER"] }, "toggle"),
|
||||||
arrayOf("fx_backgroundblur", { Lang["MENU_OPTIONS_BLUR"] }, "toggle"),
|
arrayOf("fx_backgroundblur", { Lang["MENU_OPTIONS_BLUR"] }, "toggle"),
|
||||||
arrayOf("maxparticles", { Lang["MENU_OPTIONS_PARTICLES"] }, "spinner,256,1024,256"),
|
arrayOf("maxparticles", { Lang["MENU_OPTIONS_PARTICLES"] }, "spinner,256,1024,256"),
|
||||||
@@ -39,7 +39,7 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
arrayOf("displayfps", { Lang["MENU_LABEL_FRAMESPERSEC"] }, "spinner,0,300,2"),
|
arrayOf("displayfps", { Lang["MENU_LABEL_FRAMESPERSEC"] }, "spinner,0,300,2"),
|
||||||
arrayOf("usevsync", { Lang["MENU_OPTIONS_VSYNC"] }, "toggle"),
|
arrayOf("usevsync", { Lang["MENU_OPTIONS_VSYNC"] }, "toggle"),
|
||||||
arrayOf("", { "(${Lang["MENU_LABEL_RESTART_REQUIRED"]})" }, "p"),
|
arrayOf("", { "(${Lang["MENU_LABEL_RESTART_REQUIRED"]})" }, "p"),
|
||||||
arrayOf("", { Lang["GAME_GENRE_MISC"] }, "h1"),
|
arrayOf("", { Lang["MENU_LABEL_STREAMING"] }, "h1"),
|
||||||
arrayOf("fx_streamerslayout", { Lang["MENU_OPTION_STREAMERS_LAYOUT"] }, "toggle"),
|
arrayOf("fx_streamerslayout", { Lang["MENU_OPTION_STREAMERS_LAYOUT"] }, "toggle"),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -114,7 +114,11 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
}
|
}
|
||||||
else if (args.startsWith("typeinint")) {
|
else if (args.startsWith("typeinint")) {
|
||||||
// val arg = args.split(',') // args: none
|
// val arg = args.split(',') // args: none
|
||||||
UIItemTextLineInput(this, x, y, spinnerWidth, { "${App.getConfigInt(optionName)}" }, InputLenCap(4, InputLenCap.CharLenUnit.CODEPOINTS), { it.headkey in Input.Keys.NUM_0..Input.Keys.NUM_9 || it.headkey == Input.Keys.BACKSPACE }) to { it: UIItem, optionStr: String ->
|
UIItemTextLineInput(this, x, y, spinnerWidth,
|
||||||
|
defaultValue = { "${App.getConfigInt(optionName)}" },
|
||||||
|
maxLen = InputLenCap(4, InputLenCap.CharLenUnit.CODEPOINTS),
|
||||||
|
keyFilter = { it.headkey in Input.Keys.NUM_0..Input.Keys.NUM_9 || it.headkey == Input.Keys.BACKSPACE }
|
||||||
|
) to { it: UIItem, optionStr: String ->
|
||||||
(it as UIItemTextLineInput).textCommitListener = {
|
(it as UIItemTextLineInput).textCommitListener = {
|
||||||
App.setConfig(optionStr, it.toInt()) // HAXXX!!!
|
App.setConfig(optionStr, it.toInt()) // HAXXX!!!
|
||||||
}
|
}
|
||||||
@@ -123,7 +127,12 @@ class UIGraphicsControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
else if (args.startsWith("typeinres")) {
|
else if (args.startsWith("typeinres")) {
|
||||||
val keyWidth = optionName.substringBefore(',')
|
val keyWidth = optionName.substringBefore(',')
|
||||||
val keyHeight = optionName.substringAfter(',')
|
val keyHeight = optionName.substringAfter(',')
|
||||||
UIItemTextLineInput(this, x, y, spinnerWidth, { "${App.getConfigInt(keyWidth)}x${App.getConfigInt(keyHeight)}" }, InputLenCap(9, InputLenCap.CharLenUnit.CODEPOINTS), { it.headkey == Input.Keys.ENTER || it.headkey == Input.Keys.BACKSPACE || it.character?.matches(Regex("[0-9xX]")) == true }, UIItemTextButton.Companion.Alignment.CENTRE) to { it: UIItem, optionStr: String ->
|
UIItemTextLineInput(this, x, y, spinnerWidth,
|
||||||
|
defaultValue = { "${App.getConfigInt(keyWidth)}x${App.getConfigInt(keyHeight)}" },
|
||||||
|
maxLen = InputLenCap(9, InputLenCap.CharLenUnit.CODEPOINTS),
|
||||||
|
keyFilter = { it.headkey == Input.Keys.ENTER || it.headkey == Input.Keys.BACKSPACE || it.character?.matches(Regex("[0-9xX]")) == true },
|
||||||
|
alignment = UIItemTextButton.Companion.Alignment.CENTRE
|
||||||
|
) to { it: UIItem, optionStr: String ->
|
||||||
(it as UIItemTextLineInput).textCommitListener = { text ->
|
(it as UIItemTextLineInput).textCommitListener = { text ->
|
||||||
val text = text.lowercase()
|
val text = text.lowercase()
|
||||||
if (text.matches(Regex("""[0-9]+x[0-9]+"""))) {
|
if (text.matches(Regex("""[0-9]+x[0-9]+"""))) {
|
||||||
|
|||||||
@@ -110,14 +110,14 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
private val selDrawX = (Toolkit.drawWidth - selectorWidth) / 2
|
private val selDrawX = (Toolkit.drawWidth - selectorWidth) / 2
|
||||||
private val halfw = width / 2
|
private val halfw = width / 2
|
||||||
|
|
||||||
private val y1 = 400
|
// private val y1 = 400
|
||||||
private val y2 = y1 + 40
|
// private val y2 = y1 + 40
|
||||||
|
|
||||||
private val lowLayerCodes = IME.getAllLowLayers().sorted()
|
private val lowLayerCodes = IME.getAllLowLayers().sorted()
|
||||||
private val lowLayerNames = lowLayerCodes.map { { IME.getLowLayerByName(it).name } }
|
private val lowLayerNames = lowLayerCodes.map { { IME.getLowLayerByName(it).name } }
|
||||||
private val keyboardLayoutSelection = UIItemTextSelector(this,
|
private val keyboardLayoutSelection = UIItemTextSelector(this,
|
||||||
selDrawX + (halfselw - textSelWidth) / 2,
|
selDrawX + (halfselw - textSelWidth) / 2,
|
||||||
y2,
|
kby + 260,
|
||||||
lowLayerNames,
|
lowLayerNames,
|
||||||
lowLayerCodes.linearSearch { it == App.getConfigString("basekeyboardlayout") } ?: throw IME.LayoutNotFound(App.getConfigString("basekeyboardlayout")),
|
lowLayerCodes.linearSearch { it == App.getConfigString("basekeyboardlayout") } ?: throw IME.LayoutNotFound(App.getConfigString("basekeyboardlayout")),
|
||||||
textSelWidth
|
textSelWidth
|
||||||
@@ -127,8 +127,8 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
private val imeCodes = listOf("none") + imeCodes0
|
private val imeCodes = listOf("none") + imeCodes0
|
||||||
private val imeNames = listOf({"$EMDASH"}) + imeCodes0.map { { IME.getHighLayerByName(it).name } }
|
private val imeNames = listOf({"$EMDASH"}) + imeCodes0.map { { IME.getHighLayerByName(it).name } }
|
||||||
private val imeSelection = UIItemTextSelector(this,
|
private val imeSelection = UIItemTextSelector(this,
|
||||||
selDrawX + halfselw + (halfselw - textSelWidth) / 2,
|
selDrawX + halfselw + (halfselw - textSelWidth) / 2,
|
||||||
y2,
|
kby + 260,
|
||||||
imeNames,
|
imeNames,
|
||||||
imeCodes.linearSearch { it == App.getConfigString("inputmethod") } ?: throw IME.LayoutNotFound(App.getConfigString("inputmethod")),
|
imeCodes.linearSearch { it == App.getConfigString("inputmethod") } ?: throw IME.LayoutNotFound(App.getConfigString("inputmethod")),
|
||||||
textSelWidth
|
textSelWidth
|
||||||
@@ -138,7 +138,7 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
|
|
||||||
private val keyboardTestPanel = UIItemTextLineInput(this,
|
private val keyboardTestPanel = UIItemTextLineInput(this,
|
||||||
drawX + (width - 480) / 2 + 3,
|
drawX + (width - 480) / 2 + 3,
|
||||||
height - 40,
|
drawY + height - 120,
|
||||||
474
|
474
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -171,10 +171,10 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
batch.color = Color.WHITE
|
batch.color = Color.WHITE
|
||||||
|
|
||||||
val txt1 = Lang["MENU_LABEL_KEYBOARD_LAYOUT"]; val tw1 = App.fontGame.getWidth(txt1)
|
val txt1 = Lang["MENU_LABEL_KEYBOARD_LAYOUT"]; val tw1 = App.fontGame.getWidth(txt1)
|
||||||
App.fontGame.draw(batch, txt1, selDrawX + (halfselw - tw1) / 2, y1)
|
App.fontGame.draw(batch, txt1, selDrawX + (halfselw - tw1) / 2, keyboardLayoutSelection.posY - 40)
|
||||||
|
|
||||||
val txt2 = Lang["MENU_LABEL_IME"]; val tw2 = App.fontGame.getWidth(txt2)
|
val txt2 = Lang["MENU_LABEL_IME"]; val tw2 = App.fontGame.getWidth(txt2)
|
||||||
App.fontGame.draw(batch, txt2, selDrawX + halfselw + (halfselw - tw2) / 2, y1)
|
App.fontGame.draw(batch, txt2, selDrawX + halfselw + (halfselw - tw2) / 2, keyboardLayoutSelection.posY - 40)
|
||||||
|
|
||||||
// title
|
// title
|
||||||
// todo show "Keyboard"/"Gamepad" accordingly
|
// todo show "Keyboard"/"Gamepad" accordingly
|
||||||
@@ -185,9 +185,9 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
|
|
||||||
// button help for string input UI
|
// button help for string input UI
|
||||||
val help1 = "↓ ${Lang["MENU_LABEL_IME_TOGGLE"]}"
|
val help1 = "↓ ${Lang["MENU_LABEL_IME_TOGGLE"]}"
|
||||||
App.fontGame.draw(batch, help1, drawX + 10f, height - 40f - 28f)
|
App.fontGame.draw(batch, help1, drawX + 10f, keyboardTestPanel.posY - 28f)
|
||||||
val help2 = "${Lang["MENU_LABEL_PASTE_FROM_CLIPBOARD"]} ↑"
|
val help2 = "${Lang["MENU_LABEL_PASTE_FROM_CLIPBOARD"]} ↑"
|
||||||
App.fontGame.draw(batch, help2, drawX + keyboardTestPanel.width - 4f - App.fontGame.getWidth(help2), height - 40f + 30f)
|
App.fontGame.draw(batch, help2, drawX + keyboardTestPanel.width - 4f - App.fontGame.getWidth(help2), keyboardTestPanel.posY + 30f)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,10 @@ class UIPerformanceControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
private val options = arrayOf(
|
private val options = arrayOf(
|
||||||
arrayOf("", { Lang["MENU_OPTIONS_GAMEPLAY"] }, "h1"),
|
arrayOf("", { Lang["MENU_OPTIONS_GAMEPLAY"] }, "h1"),
|
||||||
arrayOf("autosaveinterval", { Lang["MENU_OPTIONS_AUTOSAVE"] + " (${Lang["CONTEXT_TIME_MINUTE_PLURAL"]})" }, "spinnerimul,5,120,5,60000"),
|
arrayOf("autosaveinterval", { Lang["MENU_OPTIONS_AUTOSAVE"] + " (${Lang["CONTEXT_TIME_MINUTE_PLURAL"]})" }, "spinnerimul,5,120,5,60000"),
|
||||||
|
arrayOf("notificationshowuptime", { Lang["MENU_OPTIONS_NOTIFICATION_DISPLAY_DURATION"] + " (${Lang["CONTEXT_TIME_SECOND_PLURAL"]})" }, "spinnerimul,2,10,1,1000"),
|
||||||
arrayOf("", { Lang["MENU_OPTIONS_PERFORMANCE"] }, "h1"),
|
arrayOf("", { Lang["MENU_OPTIONS_PERFORMANCE"] }, "h1"),
|
||||||
arrayOf("jvm_xmx", { Lang["MENU_OPTIONS_JVM_HEAP_MAX"] + " (GB)" }, "spinner,2,32,1"),
|
arrayOf("jvm_xmx", { Lang["MENU_OPTIONS_JVM_HEAP_MAX"] + " (GB)" }, "spinner,2,32,1"),
|
||||||
|
arrayOf("jvm_extra_cmd", { Lang["MENU_LABEL_EXTRA_JVM_ARGUMENTS"] }, "typein"),
|
||||||
arrayOf("", { "(${Lang["MENU_LABEL_RESTART_REQUIRED"]})" }, "p"),
|
arrayOf("", { "(${Lang["MENU_LABEL_RESTART_REQUIRED"]})" }, "p"),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -68,6 +70,7 @@ class UIPerformanceControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
private val hrule = CommonResourcePool.getAsTextureRegionPack("gui_hrule")
|
private val hrule = CommonResourcePool.getAsTextureRegionPack("gui_hrule")
|
||||||
|
|
||||||
private val spinnerWidth = 140
|
private val spinnerWidth = 140
|
||||||
|
private val typeinWidth = 320
|
||||||
private val drawX = (Toolkit.drawWidth - width) / 2
|
private val drawX = (Toolkit.drawWidth - width) / 2
|
||||||
private val drawY = (App.scr.height - height) / 2
|
private val drawY = (App.scr.height - height) / 2
|
||||||
|
|
||||||
@@ -115,7 +118,11 @@ class UIPerformanceControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
}
|
}
|
||||||
else if (args.startsWith("typeinint")) {
|
else if (args.startsWith("typeinint")) {
|
||||||
// val arg = args.split(',') // args: none
|
// val arg = args.split(',') // args: none
|
||||||
UIItemTextLineInput(this, x, y, spinnerWidth, { "${App.getConfigInt(optionName)}" }, InputLenCap(4, InputLenCap.CharLenUnit.CODEPOINTS), { it.headkey in Input.Keys.NUM_0..Input.Keys.NUM_9 || it.headkey == Input.Keys.BACKSPACE }) to { it: UIItem, optionStr: String ->
|
UIItemTextLineInput(this, x, y, spinnerWidth,
|
||||||
|
defaultValue = { "${App.getConfigInt(optionName)}" },
|
||||||
|
maxLen = InputLenCap(4, InputLenCap.CharLenUnit.CODEPOINTS),
|
||||||
|
keyFilter = { it.headkey in Input.Keys.NUM_0..Input.Keys.NUM_9 || it.headkey == Input.Keys.BACKSPACE }
|
||||||
|
) to { it: UIItem, optionStr: String ->
|
||||||
(it as UIItemTextLineInput).textCommitListener = {
|
(it as UIItemTextLineInput).textCommitListener = {
|
||||||
App.setConfig(optionStr, it.toInt()) // HAXXX!!!
|
App.setConfig(optionStr, it.toInt()) // HAXXX!!!
|
||||||
}
|
}
|
||||||
@@ -124,7 +131,12 @@ class UIPerformanceControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
else if (args.startsWith("typeinres")) {
|
else if (args.startsWith("typeinres")) {
|
||||||
val keyWidth = optionName.substringBefore(',')
|
val keyWidth = optionName.substringBefore(',')
|
||||||
val keyHeight = optionName.substringAfter(',')
|
val keyHeight = optionName.substringAfter(',')
|
||||||
UIItemTextLineInput(this, x, y, spinnerWidth, { "${App.getConfigInt(keyWidth)}x${App.getConfigInt(keyHeight)}" }, InputLenCap(9, InputLenCap.CharLenUnit.CODEPOINTS), { it.headkey == Input.Keys.ENTER || it.headkey == Input.Keys.BACKSPACE || it.character?.matches(Regex("[0-9xX]")) == true }, UIItemTextButton.Companion.Alignment.CENTRE) to { it: UIItem, optionStr: String ->
|
UIItemTextLineInput(this, x, y, spinnerWidth,
|
||||||
|
defaultValue = { "${App.getConfigInt(keyWidth)}x${App.getConfigInt(keyHeight)}" },
|
||||||
|
maxLen = InputLenCap(9, InputLenCap.CharLenUnit.CODEPOINTS),
|
||||||
|
keyFilter = { it.headkey == Input.Keys.ENTER || it.headkey == Input.Keys.BACKSPACE || it.character?.matches(Regex("[0-9xX]")) == true },
|
||||||
|
alignment = UIItemTextButton.Companion.Alignment.CENTRE
|
||||||
|
) to { it: UIItem, optionStr: String ->
|
||||||
(it as UIItemTextLineInput).textCommitListener = { text ->
|
(it as UIItemTextLineInput).textCommitListener = { text ->
|
||||||
val text = text.lowercase()
|
val text = text.lowercase()
|
||||||
if (text.matches(Regex("""[0-9]+x[0-9]+"""))) {
|
if (text.matches(Regex("""[0-9]+x[0-9]+"""))) {
|
||||||
@@ -138,6 +150,14 @@ class UIPerformanceControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (args.startsWith("typein")) {
|
||||||
|
//args: none
|
||||||
|
UIItemTextLineInput(this, x, y, typeinWidth, defaultValue = { App.getConfigString(optionName) }) to { it: UIItem, optionStr: String ->
|
||||||
|
(it as UIItemTextLineInput).textCommitListener = {
|
||||||
|
App.setConfig(optionStr, it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else throw IllegalArgumentException(args)
|
else throw IllegalArgumentException(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ class UIItemTextLineInput(
|
|||||||
// val enableIMEButton: Boolean = true
|
// val enableIMEButton: Boolean = true
|
||||||
var keyFilter: (TerrarumKeyboardEvent) -> Boolean = { true },
|
var keyFilter: (TerrarumKeyboardEvent) -> Boolean = { true },
|
||||||
val alignment: UIItemTextButton.Companion.Alignment = UIItemTextButton.Companion.Alignment.LEFT,
|
val alignment: UIItemTextButton.Companion.Alignment = UIItemTextButton.Companion.Alignment.LEFT,
|
||||||
|
val defaultValue: (() -> String?)? = null
|
||||||
) : UIItem(parentUI, initialX, initialY) {
|
) : UIItem(parentUI, initialX, initialY) {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
@@ -403,6 +404,9 @@ class UIItemTextLineInput(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
|
defaultValue?.let {
|
||||||
|
setText(it() ?: "")
|
||||||
|
}
|
||||||
fboUpdateLatch = true
|
fboUpdateLatch = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user