mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 10:04:05 +09:00
config key change; uiitemtextbutton can now have tags alongside with the label
This commit is contained in:
@@ -92,7 +92,7 @@ object IngameRenderer : Disposable {
|
||||
shaderBlur = App.loadShaderFromFile("assets/blur.vert", "assets/blur.frag")
|
||||
|
||||
|
||||
if (App.getConfigBoolean("fxdither")) {
|
||||
if (App.getConfigBoolean("fx_dither")) {
|
||||
shaderBayer = App.loadShaderFromFile("assets/4096.vert", "assets/4096_bayer.frag")
|
||||
shaderBayer.bind()
|
||||
shaderBayer.setUniformf("rcount", 64f)
|
||||
@@ -116,7 +116,7 @@ object IngameRenderer : Disposable {
|
||||
}
|
||||
|
||||
|
||||
if (App.getConfigBoolean("fxdither")) {
|
||||
if (App.getConfigBoolean("fx_dither")) {
|
||||
if (!shaderBayer.isCompiled) {
|
||||
Gdx.app.log("shaderBayer", shaderBayer.log)
|
||||
exitProcess(1)
|
||||
|
||||
@@ -223,22 +223,22 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
|
||||
private fun updateGamerControlBox() {
|
||||
if (isGamer) {
|
||||
isUpDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keyup"))
|
||||
isLeftDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keyleft"))
|
||||
isDownDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keydown"))
|
||||
isRightDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keyright"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keyjump"))
|
||||
isUpDown = Gdx.input.isKeyPressed(App.getConfigInt("control_key_up"))
|
||||
isLeftDown = Gdx.input.isKeyPressed(App.getConfigInt("control_key_left"))
|
||||
isDownDown = Gdx.input.isKeyPressed(App.getConfigInt("control_key_down"))
|
||||
isRightDown = Gdx.input.isKeyPressed(App.getConfigInt("control_key_right"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(App.getConfigInt("control_key_jump"))
|
||||
|
||||
val gamepad = App.gamepad
|
||||
|
||||
if (gamepad != null) {
|
||||
axisX = gamepad.getAxis(App.getConfigInt("config_gamepadaxislx"))
|
||||
axisY = gamepad.getAxis(App.getConfigInt("config_gamepadaxisly"))
|
||||
axisRX = gamepad.getAxis(App.getConfigInt("config_gamepadaxisrx"))
|
||||
axisRY = gamepad.getAxis(App.getConfigInt("config_gamepadaxisry"))
|
||||
axisX = gamepad.getAxis(App.getConfigInt("control_gamepad_axislx"))
|
||||
axisY = gamepad.getAxis(App.getConfigInt("control_gamepad_axisly"))
|
||||
axisRX = gamepad.getAxis(App.getConfigInt("control_gamepad_axisrx"))
|
||||
axisRY = gamepad.getAxis(App.getConfigInt("control_gamepad_axisry"))
|
||||
|
||||
isJumpDown = Gdx.input.isKeyPressed(App.getConfigInt("config_keyjump")) ||
|
||||
gamepad.getButton(App.getConfigInt("config_gamepadltrigger"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(App.getConfigInt("control_key_jump")) ||
|
||||
gamepad.getButton(App.getConfigInt("control_gamepad_ltrigger"))
|
||||
}
|
||||
|
||||
if (isJumpJustDown && jumpJustPressedLatched) {
|
||||
@@ -307,11 +307,11 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
// ↑F, ↓S
|
||||
if (isRightDown && !isLeftDown) {
|
||||
walkHorizontal(false, AXIS_KEYBOARD)
|
||||
prevHMoveKey = App.getConfigInt("config_keyright")
|
||||
prevHMoveKey = App.getConfigInt("control_key_right")
|
||||
} // ↓F, ↑S
|
||||
else if (isLeftDown && !isRightDown) {
|
||||
walkHorizontal(true, AXIS_KEYBOARD)
|
||||
prevHMoveKey = App.getConfigInt("config_keyleft")
|
||||
prevHMoveKey = App.getConfigInt("control_key_left")
|
||||
} // ↓F, ↓S
|
||||
/*else if (isLeftDown && isRightDown) {
|
||||
if (prevHMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_LEFT)) {
|
||||
@@ -335,11 +335,11 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
// ↑E, ↓D
|
||||
if (isDownDown && !isUpDown) {
|
||||
walkVertical(false, AXIS_KEYBOARD)
|
||||
prevVMoveKey = App.getConfigInt("config_keydown")
|
||||
prevVMoveKey = App.getConfigInt("control_key_down")
|
||||
} // ↓E, ↑D
|
||||
else if (isUpDown && !isDownDown) {
|
||||
walkVertical(true, AXIS_KEYBOARD)
|
||||
prevVMoveKey = App.getConfigInt("config_keyup")
|
||||
prevVMoveKey = App.getConfigInt("control_key_up")
|
||||
} // ↓E, ↓D
|
||||
/*else if (isUpDown && isDownDown) {
|
||||
if (prevVMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_UP)) {
|
||||
|
||||
@@ -54,8 +54,8 @@ internal class FixtureStorageChest : FixtureBase {
|
||||
|
||||
|
||||
internal class UIStorageChest : UICanvas(
|
||||
toggleKeyLiteral = App.getConfigInt("config_keyinventory"),
|
||||
toggleButtonLiteral = App.getConfigInt("config_gamepadstart"),
|
||||
toggleKeyLiteral = App.getConfigInt("control_key_inventory"),
|
||||
toggleButtonLiteral = App.getConfigInt("control_gamepad_start"),
|
||||
), HasInventory {
|
||||
|
||||
lateinit var chestInventory: FixtureInventory
|
||||
|
||||
@@ -42,7 +42,7 @@ class UIBasicInfo() : UICanvas() {
|
||||
ELuptimer += delta
|
||||
}
|
||||
|
||||
if (mouseUp || Gdx.input.isKeyPressed(App.getConfigInt("config_keyinteract"))) {
|
||||
if (mouseUp || Gdx.input.isKeyPressed(App.getConfigInt("control_key_interact"))) {
|
||||
ELuptimer = 0f
|
||||
ELon = true
|
||||
}
|
||||
|
||||
@@ -157,10 +157,10 @@ package net.torvald.terrarum.modulebasegame.ui
|
||||
private var isEncumbered = false
|
||||
|
||||
|
||||
private val seekLeft: Int; get() = AppLoader.getConfigInt("config_keyleft") // getter used to support in-game keybind changing
|
||||
private val seekRight: Int; get() = AppLoader.getConfigInt("config_keyright") // getter used to support in-game keybind changing
|
||||
private val seekUp: Int; get() = AppLoader.getConfigInt("config_keyup") // getter used to support in-game keybind changing
|
||||
private val seekDown: Int; get() = AppLoader.getConfigInt("config_keydown") // getter used to support in-game keybind changing
|
||||
private val seekLeft: Int; get() = AppLoader.getConfigInt("control_key_left") // getter used to support in-game keybind changing
|
||||
private val seekRight: Int; get() = AppLoader.getConfigInt("control_key_right") // getter used to support in-game keybind changing
|
||||
private val seekUp: Int; get() = AppLoader.getConfigInt("control_key_up") // getter used to support in-game keybind changing
|
||||
private val seekDown: Int; get() = AppLoader.getConfigInt("control_key_down") // getter used to support in-game keybind changing
|
||||
|
||||
|
||||
init {
|
||||
|
||||
@@ -20,7 +20,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
* Created by minjaesong on 2017-10-21.
|
||||
*/
|
||||
class UIInventoryFull(
|
||||
toggleKeyLiteral: Int? = App.getConfigInt("config_keyinventory"), toggleButtonLiteral: Int? = App.getConfigInt("config_gamepadstart"),
|
||||
toggleKeyLiteral: Int? = App.getConfigInt("control_key_inventory"), toggleButtonLiteral: Int? = App.getConfigInt("control_gamepad_start"),
|
||||
// UI positions itself? (you must g.flush() yourself after the g.translate(Int, Int))
|
||||
customPositioning: Boolean = false, // mainly used by vital meter
|
||||
doNotWarnConstant: Boolean = false
|
||||
@@ -112,10 +112,10 @@ class UIInventoryFull(
|
||||
private val SP = "\u3000 "
|
||||
val listControlHelp: String
|
||||
get() = if (App.environment == RunningEnvironment.PC)
|
||||
"${getKeycapPC(App.getConfigInt("config_keyinventory"))} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
|
||||
"${getKeycapPC(App.getConfigInt("control_key_inventory"))} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
|
||||
"${0xe006.toChar()} ${Lang["GAME_INVENTORY_USE"]}$SP" +
|
||||
"${0xe011.toChar()}$ENDASH${0x2009.toChar()}${0xe010.toChar()} ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
|
||||
"${getKeycapPC(App.getConfigInt("config_keydiscard"))} ${Lang["GAME_INVENTORY_DROP"]}"
|
||||
"${getKeycapPC(App.getConfigInt("control_key_discard"))} ${Lang["GAME_INVENTORY_DROP"]}"
|
||||
else
|
||||
"$gamepadLabelStart ${Lang["GAME_ACTION_CLOSE"]}$SP" +
|
||||
"$gamepadLabelLT ${Lang["CONTEXT_ITEM_MAP"]}$SP" +
|
||||
|
||||
@@ -134,17 +134,17 @@ class UIKeyboardControlPanel : UICanvas() {
|
||||
keycaps.values.forEach { addUIitem(it) }
|
||||
|
||||
// read config and put icons
|
||||
keycaps[App.getConfigInt("config_keyup")]?.symbolControl = symbolUp
|
||||
keycaps[App.getConfigInt("config_keyleft")]?.symbolControl = symbolLeft
|
||||
keycaps[App.getConfigInt("config_keydown")]?.symbolControl = symbolDown
|
||||
keycaps[App.getConfigInt("config_keyright")]?.symbolControl = symbolRight
|
||||
keycaps[App.getConfigInt("control_key_up")]?.symbolControl = symbolUp
|
||||
keycaps[App.getConfigInt("control_key_left")]?.symbolControl = symbolLeft
|
||||
keycaps[App.getConfigInt("control_key_down")]?.symbolControl = symbolDown
|
||||
keycaps[App.getConfigInt("control_key_right")]?.symbolControl = symbolRight
|
||||
|
||||
keycaps[App.getConfigInt("config_keyjump")]?.symbolControl = symbolJump
|
||||
keycaps[App.getConfigInt("config_keyzoom")]?.symbolControl = symbolZoom
|
||||
keycaps[App.getConfigInt("config_keyinventory")]?.symbolControl = symbolInventory
|
||||
keycaps[App.getConfigInt("config_keymovementaux")]?.symbolControl = symbolGrapplingHook
|
||||
keycaps[App.getConfigInt("control_key_jump")]?.symbolControl = symbolJump
|
||||
keycaps[App.getConfigInt("control_key_zoom")]?.symbolControl = symbolZoom
|
||||
keycaps[App.getConfigInt("control_key_inventory")]?.symbolControl = symbolInventory
|
||||
keycaps[App.getConfigInt("control_key_movementaux")]?.symbolControl = symbolGrapplingHook
|
||||
|
||||
keycaps[App.getConfigInt("config_keygamemenu")]?.symbolControl = symbolGamemenu
|
||||
keycaps[App.getConfigInt("control_key_gamemenu")]?.symbolControl = symbolGamemenu
|
||||
}
|
||||
|
||||
override fun updateUI(delta: Float) {
|
||||
|
||||
@@ -58,7 +58,7 @@ class UILoadDemoSavefiles : UICanvas() {
|
||||
|
||||
private val controlHelp: String
|
||||
get() = if (App.environment == RunningEnvironment.PC)
|
||||
"${getKeycapPC(App.getConfigInt("config_keyup"))}${getKeycapPC(App.getConfigInt("config_keydown"))}" +
|
||||
"${getKeycapPC(App.getConfigInt("control_key_up"))}${getKeycapPC(App.getConfigInt("control_key_down"))}" +
|
||||
" ${Lang["MENU_CONTROLS_SCROLL"]}"
|
||||
else
|
||||
"${getKeycapConsole('R')} ${Lang["MENU_CONTROLS_SCROLL"]}"
|
||||
@@ -185,12 +185,12 @@ class UILoadDemoSavefiles : UICanvas() {
|
||||
|
||||
override fun keyDown(keycode: Int): Boolean {
|
||||
if (this.isVisible) {
|
||||
if ((keycode == Input.Keys.UP || keycode == App.getConfigInt("config_keyup")) && scrollTarget > 0) {
|
||||
if ((keycode == Input.Keys.UP || keycode == App.getConfigInt("control_key_up")) && scrollTarget > 0) {
|
||||
scrollFrom = listScroll
|
||||
scrollTarget -= 1
|
||||
scrollAnimCounter = 0f
|
||||
}
|
||||
else if ((keycode == Input.Keys.DOWN || keycode == App.getConfigInt("config_keydown")) && scrollTarget < uiItems.size - savesVisible) {
|
||||
else if ((keycode == Input.Keys.DOWN || keycode == App.getConfigInt("control_key_down")) && scrollTarget < uiItems.size - savesVisible) {
|
||||
scrollFrom = listScroll
|
||||
scrollTarget += 1
|
||||
scrollAnimCounter = 0f
|
||||
|
||||
@@ -37,7 +37,7 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
|
||||
private val screens = ArrayList<Pair<String, UICanvas>>()
|
||||
|
||||
private val yamlSep = Yaml.SEPARATOR
|
||||
|
||||
private val tagSep = "+"
|
||||
init {
|
||||
remoConTray = generateNewRemoCon(currentRemoConContents)
|
||||
|
||||
@@ -70,8 +70,9 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
|
||||
private var mouseActionAvailable = true
|
||||
|
||||
private fun generateNewRemoCon(node: QNDTreeNode<String>): UIRemoConElement {
|
||||
val dynamicStrArray = Array(node.children.size, { node.children[it].data?.split(yamlSep)?.get(0) ?: "(null)" })
|
||||
return UIRemoConElement(this, dynamicStrArray)
|
||||
val labels = Array(node.children.size) { node.children[it].data?.split(yamlSep)?.get(0)?.split(tagSep)?.get(0) ?: "(null)" }
|
||||
val tags = Array(node.children.size) { arrayOf(node.children[it].data?.split(yamlSep)?.get(0)?.split(tagSep)?.getOrNull(1) ?: "") }
|
||||
return UIRemoConElement(this, labels, tags)
|
||||
}
|
||||
|
||||
// currently there's no resetter for this!
|
||||
@@ -94,11 +95,9 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
|
||||
Gdx.app.exit()
|
||||
}
|
||||
else if (it.labelText.startsWith("MENU_LABEL_RETURN")) {
|
||||
val tag = it.labelText.substringAfter('+')
|
||||
val tag = it.tags
|
||||
if (tag.contains("WRITETOCONFIG")) WriteConfig()
|
||||
|
||||
when (tag) {
|
||||
"WRITETOCONFIG" -> WriteConfig()
|
||||
}
|
||||
|
||||
if (currentRemoConContents.parent != null) {
|
||||
remoConTray.consume()
|
||||
@@ -256,7 +255,7 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
|
||||
|
||||
|
||||
|
||||
class UIRemoConElement(uiRemoCon: UIRemoCon, val labels: Array<String>) {
|
||||
class UIRemoConElement(uiRemoCon: UIRemoCon, val labels: Array<String>, val tags: Array<Array<String>>) {
|
||||
|
||||
private val lineHeight = 36
|
||||
|
||||
@@ -275,7 +274,8 @@ open class UIRemoCon(val parent: TitleScreen, treeRepresentation: QNDTreeNode<St
|
||||
inactiveCol = Color.WHITE,
|
||||
defaultSelection = null,
|
||||
itemHitboxSize = lineHeight - 2,
|
||||
alignment = UIItemTextButton.Companion.Alignment.LEFT
|
||||
alignment = UIItemTextButton.Companion.Alignment.LEFT,
|
||||
tagsCollection = tags
|
||||
)
|
||||
|
||||
fun update(delta: Float) {
|
||||
|
||||
@@ -17,7 +17,7 @@ import net.torvald.terrarum.ui.UICanvas
|
||||
* Created by minjaesong on 2019-08-11.
|
||||
*/
|
||||
class UIScreenZoom : UICanvas(
|
||||
App.getConfigInt("config_keyzoom")
|
||||
App.getConfigInt("control_key_zoom")
|
||||
) {
|
||||
|
||||
val zoomText = "${getKeycapPC(handler.toggleKeyLiteral!!)} $EMDASH Zoom Out"
|
||||
|
||||
@@ -45,7 +45,7 @@ class UITierOneWatch() : UICanvas() {
|
||||
ELuptimer += delta
|
||||
}
|
||||
|
||||
if (mouseUp || Gdx.input.isKeyPressed(App.getConfigInt("config_keyinteract"))) {
|
||||
if (mouseUp || Gdx.input.isKeyPressed(App.getConfigInt("control_key_interact"))) {
|
||||
ELuptimer = 0f
|
||||
ELon = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user