mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
config key change; uiitemtextbutton can now have tags alongside with the label
This commit is contained in:
@@ -1,84 +0,0 @@
|
||||
{
|
||||
"displayfps": 0,
|
||||
"usevsync": false,
|
||||
"screenwidth": 1280,
|
||||
"screenheight": 720,
|
||||
"language": "enUS",
|
||||
"notificationshowuptime": 4000,
|
||||
"multithread": true,
|
||||
"multithreadedlight": false,
|
||||
"showhealthmessageonstartup": true,
|
||||
"usexinput": true,
|
||||
"config_gamepadkeyn": 3,
|
||||
"config_gamepadkeyw": 2,
|
||||
"config_gamepadkeys": 0,
|
||||
"config_gamepadkeye": 1,
|
||||
"config_gamepadlup": 4,
|
||||
"config_gamepadrup": 5,
|
||||
"config_gamepadselect": 6,
|
||||
"config_gamepadstart": 7,
|
||||
"config_gamepadltrigger": 8,
|
||||
"config_gamepadrtrigger": 9,
|
||||
"config_gamepadlthumb": 10,
|
||||
"config_gamepadrthumb": 11,
|
||||
"config_gamepadaxislx": 1,
|
||||
"config_gamepadaxisly": 0,
|
||||
"config_gamepadaxisrx": 3,
|
||||
"config_gamepadaxisry": 2,
|
||||
"config_gamepadtriggeraxis": 4,
|
||||
"config_gamepadtriggeraxis2": 5,
|
||||
"gamepadaxiszeropoints": [
|
||||
-0.011,
|
||||
-0.022,
|
||||
-0.033,
|
||||
-0.044
|
||||
],
|
||||
"gamepadlabelstyle": "msxbone",
|
||||
"config_keyup":33,
|
||||
"config_keyleft":47,
|
||||
"config_keydown":32,
|
||||
"config_keyright":34,
|
||||
"config_keyinventory":45,
|
||||
"config_keyinteract":46,
|
||||
"config_keymovementaux": 29,
|
||||
"config_keyclose": 31,
|
||||
"config_keyzoom": 54,
|
||||
"config_keygamemenu": 61,
|
||||
"config_keyquicksel": 59,
|
||||
"config_keyquickselalt": [
|
||||
67,
|
||||
129,
|
||||
73
|
||||
],
|
||||
"config_keyjump": 62,
|
||||
"config_keyquickslots": [
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15,
|
||||
16,
|
||||
7
|
||||
],
|
||||
"config_mouseprimary": 0,
|
||||
"config_mousesecondary": 1,
|
||||
"pcgamepadenv": "console",
|
||||
"maxparticles": 768,
|
||||
"temperatureunit": 1,
|
||||
"fxretro": false,
|
||||
"buildingmakerfavs": [
|
||||
148,
|
||||
48,
|
||||
50,
|
||||
17,
|
||||
19,
|
||||
18,
|
||||
176,
|
||||
4144,
|
||||
4146,
|
||||
4244
|
||||
]
|
||||
}
|
||||
@@ -473,7 +473,7 @@ public class App implements ApplicationListener {
|
||||
gamepad.getAxisRaw(2),
|
||||
gamepad.getAxisRaw(3)
|
||||
};
|
||||
setConfig("gamepadaxiszeropoints", axesZeroPoints);
|
||||
setConfig("control_gamepad_axiszeropoints", axesZeroPoints);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
printdbg(this, "Axis " + i + ": " + axesZeroPoints[i]);
|
||||
}
|
||||
@@ -844,14 +844,14 @@ public class App implements ApplicationListener {
|
||||
}
|
||||
|
||||
public static void setGamepadButtonLabels() {
|
||||
switch (getConfigString("gamepadlabelstyle")) {
|
||||
switch (getConfigString("control_gamepad_labelstyle")) {
|
||||
case "nwii" : gamepadLabelStart = 0xE04B; break; // + mark
|
||||
case "logitech" : gamepadLabelStart = 0xE05A; break; // number 10
|
||||
case "msxbone" : gamepadLabelStart = 0xE049; break; // trifold equal sign?
|
||||
default : gamepadLabelStart = 0xE042; break; // |> mark (sonyps, msxb360, generic)
|
||||
}
|
||||
|
||||
switch (getConfigString("gamepadlabelstyle")) {
|
||||
switch (getConfigString("control_gamepad_labelstyle")) {
|
||||
case "nwii" : gamepadLabelSelect = 0xE04D; break; // - mark
|
||||
case "logitech" : gamepadLabelSelect = 0xE059; break; // number 9
|
||||
case "sonyps" : gamepadLabelSelect = 0xE043; break; // solid rectangle
|
||||
@@ -861,7 +861,7 @@ public class App implements ApplicationListener {
|
||||
}
|
||||
|
||||
|
||||
switch (getConfigString("gamepadlabelstyle")) {
|
||||
switch (getConfigString("control_gamepad_labelstyle")) {
|
||||
case "msxb360": case "msxbone" : {
|
||||
gamepadLabelSouth = 0xE061;
|
||||
gamepadLabelEast = 0xE062;
|
||||
|
||||
@@ -19,64 +19,63 @@ object DefaultConfig {
|
||||
"language" to App.getSysLang(),
|
||||
"notificationshowuptime" to 4000,
|
||||
"multithread" to true,
|
||||
"multithreadedlight" to false,
|
||||
|
||||
"showhealthmessageonstartup" to true,
|
||||
|
||||
"usexinput" to true, // when FALSE, LT+RT input on xbox controller is impossible
|
||||
|
||||
"config_gamepadkeyn" to 3,
|
||||
"config_gamepadkeyw" to 2,
|
||||
"config_gamepadkeys" to 0,
|
||||
"config_gamepadkeye" to 1, // xbox indices
|
||||
"control_gamepad_keyn" to 3,
|
||||
"control_gamepad_keyw" to 2,
|
||||
"control_gamepad_keys" to 0,
|
||||
"control_gamepad_keye" to 1, // xbox indices
|
||||
|
||||
"config_gamepadlup" to 4,
|
||||
"config_gamepadrup" to 5,
|
||||
"config_gamepadselect" to 6,
|
||||
"config_gamepadstart" to 7,
|
||||
"control_gamepad_lup" to 4,
|
||||
"control_gamepad_rup" to 5,
|
||||
"control_gamepad_select" to 6,
|
||||
"control_gamepad_start" to 7,
|
||||
|
||||
"config_gamepadltrigger" to 8,
|
||||
"config_gamepadrtrigger" to 9,
|
||||
"config_gamepadlthumb" to 10,
|
||||
"config_gamepadrthumb" to 11,
|
||||
"control_gamepad_ltrigger" to 8,
|
||||
"control_gamepad_rtrigger" to 9,
|
||||
"control_gamepad_lthumb" to 10,
|
||||
"control_gamepad_rthumb" to 11,
|
||||
|
||||
|
||||
"config_gamepadaxislx" to 1,
|
||||
"config_gamepadaxisly" to 0,
|
||||
"config_gamepadaxisrx" to 3,
|
||||
"config_gamepadaxisry" to 2, // 0-1-2-3 but sometimes 3-2-1-0 ?! what the actual fuck?
|
||||
"config_gamepadtriggeraxis" to 4, // positive: LT, negative: RT (xbox pad)
|
||||
"config_gamepadtriggeraxis2" to 5, // just in case... (RT)
|
||||
"control_gamepad_axislx" to 1,
|
||||
"control_gamepad_axisly" to 0,
|
||||
"control_gamepad_axisrx" to 3,
|
||||
"control_gamepad_axisry" to 2, // 0-1-2-3 but sometimes 3-2-1-0 ?! what the actual fuck?
|
||||
"control_gamepad_triggeraxis" to 4, // positive: LT, negative: RT (xbox pad)
|
||||
"control_gamepad_triggeraxis2" to 5, // just in case... (RT)
|
||||
|
||||
// to accomodate shifted zero point of analog stick
|
||||
"gamepadaxiszeropoints" to doubleArrayOf(-0.011, -0.022, -0.033, -0.044),
|
||||
"control_gamepad_axiszeropoints" to doubleArrayOf(0.0,0.0,0.0,0.0),
|
||||
|
||||
"gamepadlabelstyle" to "msxbone", // "nwii", "logitech", "sonyps", "msxb360", "msxbone"
|
||||
"control_gamepad_labelstyle" to "msxbone", // "nwii", "logitech", "sonyps", "msxb360", "msxbone"
|
||||
|
||||
// control-keyboard (GDX key codes,
|
||||
"config_keyup" to Input.Keys.E,
|
||||
"config_keyleft" to Input.Keys.S,
|
||||
"config_keydown" to Input.Keys.D,
|
||||
"config_keyright" to Input.Keys.F, // ESDF Masterrace
|
||||
"control_key_up" to Input.Keys.E,
|
||||
"control_key_left" to Input.Keys.S,
|
||||
"control_key_down" to Input.Keys.D,
|
||||
"control_key_right" to Input.Keys.F, // ESDF Masterrace
|
||||
|
||||
"config_keymovementaux" to Input.Keys.A, // movement-auxiliary, or hookshot
|
||||
"config_keyinventory" to Input.Keys.Q,
|
||||
"config_keyinteract" to Input.Keys.R,
|
||||
"config_keydiscard" to Input.Keys.T,
|
||||
"config_keyclose" to Input.Keys.C, // this or hard-coded ESC
|
||||
"config_keyzoom" to Input.Keys.Z,
|
||||
"control_key_movementaux" to Input.Keys.A, // movement-auxiliary, or hookshot
|
||||
"control_key_inventory" to Input.Keys.Q,
|
||||
"control_key_interact" to Input.Keys.R,
|
||||
"control_key_discard" to Input.Keys.T,
|
||||
"control_key_close" to Input.Keys.C, // this or hard-coded ESC
|
||||
"control_key_zoom" to Input.Keys.Z,
|
||||
|
||||
"config_keygamemenu" to Input.Keys.TAB,
|
||||
"config_keyquicksel" to Input.Keys.SHIFT_LEFT, // pie menu is now LShift because GDX does not read CapsLock
|
||||
"control_key_gamemenu" to Input.Keys.TAB,
|
||||
"control_key_quicksel" to Input.Keys.SHIFT_LEFT, // pie menu is now LShift because GDX does not read CapsLock
|
||||
// Colemak, Workman and some typers use CapsLock as Backspace, Apple-JIS and HHKB has Control in place of CapsLock and often re-assigned to Command
|
||||
// so these keys are treated as the same.
|
||||
// FOR ~~FUCKS~~ERGONOMICS' SAKE DON'T USE CTRL AND ALT AS A KEY!
|
||||
"config_keyquickselalt" to intArrayOf(Input.Keys.BACKSPACE, Input.Keys.CONTROL_LEFT, Input.Keys.BACKSLASH),
|
||||
"config_mousequicksel" to Input.Buttons.MIDDLE, // middle click to open pie menu
|
||||
"control_key_quickselalt" to intArrayOf(Input.Keys.BACKSPACE, Input.Keys.CONTROL_LEFT, Input.Keys.BACKSLASH),
|
||||
"control_mouse_quicksel" to Input.Buttons.MIDDLE, // middle click to open pie menu
|
||||
|
||||
"config_keyjump" to Input.Keys.SPACE,
|
||||
"control_key_jump" to Input.Keys.SPACE,
|
||||
|
||||
"config_keyquickslots" to (Input.Keys.NUM_0..Input.Keys.NUM_9).toList().toIntArray(),
|
||||
"control_key_quickslots" to (Input.Keys.NUM_0..Input.Keys.NUM_9).toList().toIntArray(),
|
||||
|
||||
"config_mouseprimary" to Input.Buttons.LEFT, // left mouse
|
||||
"config_mousesecondary" to Input.Buttons.RIGHT, // right mouse
|
||||
@@ -93,10 +92,10 @@ object DefaultConfig {
|
||||
|
||||
|
||||
// "fancy" graphics settings
|
||||
"fxdither" to true,
|
||||
"fxretro" to false,
|
||||
"fxblurredbackground" to true,
|
||||
//"fx3dlut" to false,
|
||||
"fx_dither" to true,
|
||||
"fx_retro" to false,
|
||||
"fx_backgroundblur" to true,
|
||||
//"fx_3dlut" to false,
|
||||
|
||||
|
||||
// settings regarding debugger
|
||||
|
||||
@@ -127,7 +127,7 @@ object PostProcessor : Disposable {
|
||||
|
||||
private fun postShader(projMat: Matrix4, fbo: FrameBuffer) {
|
||||
val shader: ShaderProgram? =
|
||||
if (App.getConfigBoolean("fxretro"))
|
||||
if (App.getConfigBoolean("fx_retro"))
|
||||
App.shaderHicolour
|
||||
else
|
||||
App.shaderPassthruRGB
|
||||
|
||||
@@ -61,7 +61,7 @@ class UIFakeBlurOverlay(val blurRadius: Float, val nodarken: Boolean) : UICanvas
|
||||
|
||||
override fun updateUI(delta: Float) {}
|
||||
override fun renderUI(batch: SpriteBatch, camera: Camera) {
|
||||
if (App.getConfigBoolean("fxblurredbackground")) {
|
||||
if (App.getConfigBoolean("fx_backgroundblur")) {
|
||||
Toolkit.blurEntireScreen(batch, camera as OrthographicCamera, blurRadius, 0, 0, width, height)
|
||||
}
|
||||
|
||||
|
||||
@@ -45,11 +45,11 @@ interface TerrarumController {
|
||||
*/
|
||||
fun getAxisRaw(index: Int): Float
|
||||
/**
|
||||
* Returns deadzone-applied axis value. Deadzone must be stored in the app's config database as the IntArray gamepadaxiszeropoints
|
||||
* Returns deadzone-applied axis value. Deadzone must be stored in the app's config database as the IntArray control_gamepad_axiszeropoints
|
||||
*/
|
||||
fun getAxis(index:Int): Float {
|
||||
val raw = getAxisRaw(index)
|
||||
val zero = if (index < 4) getConfigDoubleArray("gamepadaxiszeropoints")[index] else 0.0
|
||||
val zero = if (index < 4) getConfigDoubleArray("control_gamepad_axiszeropoints")[index] else 0.0
|
||||
val compensatedRaw = raw - zero
|
||||
val inDeadzone = Math.abs(compensatedRaw) < gamepadDeadzone
|
||||
|
||||
@@ -58,7 +58,7 @@ interface TerrarumController {
|
||||
|
||||
fun inDeadzone(axis: Int): Boolean {
|
||||
val ax = getAxisRaw(axis)
|
||||
val zero = if (axis < 4) getConfigDoubleArray("gamepadaxiszeropoints")[axis] else 0.0
|
||||
val zero = if (axis < 4) getConfigDoubleArray("control_gamepad_axiszeropoints")[axis] else 0.0
|
||||
|
||||
return Math.abs(ax - zero) < gamepadDeadzone
|
||||
}
|
||||
|
||||
@@ -160,14 +160,14 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
terrarumIngame.actorNowPlaying?.keyDown(keycode)
|
||||
|
||||
// quickslot by number keys
|
||||
val quickslotKeys = App.getConfigIntArray("config_keyquickslots")
|
||||
val quickslotKeys = App.getConfigIntArray("control_key_quickslots")
|
||||
if (keycode in quickslotKeys) {
|
||||
terrarumIngame.actorNowPlaying?.actorValue?.set(AVKey.__PLAYER_QUICKSLOTSEL, quickslotKeys.indexOf(keycode))
|
||||
}
|
||||
|
||||
// pie menu
|
||||
if (App.getConfigIntArray("config_keyquickselalt").contains(keycode)
|
||||
|| keycode == App.getConfigInt("config_keyquicksel")) {
|
||||
if (App.getConfigIntArray("control_key_quickselalt").contains(keycode)
|
||||
|| keycode == App.getConfigInt("control_key_quicksel")) {
|
||||
terrarumIngame.uiPieMenu.setAsOpen()
|
||||
terrarumIngame.uiQuickBar.setAsClose()
|
||||
}
|
||||
@@ -192,8 +192,8 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
}
|
||||
|
||||
private fun tKeyUp(keycode: Int): Boolean {
|
||||
if (App.getConfigIntArray("config_keyquickselalt").contains(keycode)
|
||||
|| keycode == App.getConfigInt("config_keyquicksel")) {
|
||||
if (App.getConfigIntArray("control_key_quickselalt").contains(keycode)
|
||||
|| keycode == App.getConfigInt("control_key_quicksel")) {
|
||||
terrarumIngame.uiPieMenu.setAsClose()
|
||||
terrarumIngame.uiQuickBar.setAsOpen()
|
||||
}
|
||||
@@ -230,7 +230,7 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
}
|
||||
|
||||
// pie menu
|
||||
if (button == App.getConfigInt("config_mousequicksel")) {
|
||||
if (button == App.getConfigInt("control_mouse_quicksel")) {
|
||||
terrarumIngame.uiPieMenu.setAsClose()
|
||||
terrarumIngame.uiQuickBar.setAsOpen()
|
||||
}
|
||||
@@ -263,7 +263,7 @@ class IngameController(val terrarumIngame: TerrarumIngame) : InputAdapter() {
|
||||
terrarumIngame.uiContainer.forEach { it?.touchDown(screenX, screenY, pointer, button) }
|
||||
|
||||
// pie menu
|
||||
if (button == App.getConfigInt("config_mousequicksel")) {
|
||||
if (button == App.getConfigInt("control_mouse_quicksel")) {
|
||||
terrarumIngame.uiPieMenu.setAsOpen()
|
||||
terrarumIngame.uiQuickBar.setAsClose()
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -37,12 +37,6 @@ object WriteConfig {
|
||||
}
|
||||
|
||||
operator fun invoke() {
|
||||
println("Writing config...")
|
||||
App.gameConfig.hashMap.forEach { s, any ->
|
||||
println("config $s = $any")
|
||||
}
|
||||
|
||||
|
||||
val writer = java.io.FileWriter(App.configDir, false)
|
||||
writer.write(jsoner.prettyPrint(App.gameConfig))
|
||||
writer.close()
|
||||
|
||||
@@ -205,8 +205,8 @@ class BasicDebugInfoWindow : UICanvas() {
|
||||
val gamepad = (Terrarum.ingame as? TerrarumIngame)?.ingameController?.gamepad
|
||||
if (gamepad != null) {
|
||||
drawGamepadAxis(gamepad, batch,
|
||||
gamepad.getAxis(App.getConfigInt("config_gamepadaxislx")),
|
||||
gamepad.getAxis(App.getConfigInt("config_gamepadaxisly")),
|
||||
gamepad.getAxis(App.getConfigInt("control_gamepad_axislx")),
|
||||
gamepad.getAxis(App.getConfigInt("control_gamepad_axisly")),
|
||||
App.scr.width - 128 - TinyAlphNum.W * 2,
|
||||
line(3).toInt()
|
||||
)
|
||||
|
||||
@@ -25,7 +25,7 @@ class UIItemConfigKeycap(
|
||||
if (keySize < 3) throw IllegalArgumentException("Key size must be greater than 2 (got $keySize)")
|
||||
|
||||
CommonResourcePool.addToLoadingList("ui_item_keymap_keycap") {
|
||||
TextureRegionPack("./assets/graphics/gui/ui_config_keymap_keycap.tga", 8, 32)
|
||||
TextureRegionPack("./assets/graphics/gui/ui_control_key_map_keycap.tga", 8, 32)
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
}
|
||||
|
||||
@@ -44,7 +44,9 @@ open class UIItemTextButton(
|
||||
val postGapX: Int = 0,
|
||||
|
||||
val alignment: Alignment = Alignment.CENTRE,
|
||||
val hitboxSize: Int = UIItemTextButton.height
|
||||
val hitboxSize: Int = UIItemTextButton.height,
|
||||
|
||||
val tags: Array<String> = arrayOf("")
|
||||
) : UIItem(parentUI, initialX, initialY) {
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -53,7 +53,8 @@ class UIItemTextButtonList(
|
||||
val kinematic: Boolean = false,
|
||||
|
||||
val alignment: UIItemTextButton.Companion.Alignment = UIItemTextButton.Companion.Alignment.CENTRE,
|
||||
val itemHitboxSize: Int = lineHeight
|
||||
val itemHitboxSize: Int = lineHeight,
|
||||
tagsCollection: Array<Array<String>> = Array(labelsList.size) { arrayOf("") }
|
||||
) : UIItem(parentUI, initialX, initialY) {
|
||||
|
||||
companion object {
|
||||
@@ -101,7 +102,8 @@ class UIItemTextButtonList(
|
||||
preGapX = pregap,
|
||||
postGapX = postgap,
|
||||
alignment = alignment,
|
||||
hitboxSize = itemHitboxSize
|
||||
hitboxSize = itemHitboxSize,
|
||||
tags = tagsCollection[i]
|
||||
)
|
||||
}
|
||||
else {
|
||||
@@ -122,7 +124,8 @@ class UIItemTextButtonList(
|
||||
preGapX = pregap,
|
||||
postGapX = postgap,
|
||||
alignment = alignment,
|
||||
hitboxSize = itemHitboxSize
|
||||
hitboxSize = itemHitboxSize,
|
||||
tags = tagsCollection[i]
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ internal object WeatherMixer : RNGConsumer {
|
||||
skyboxTexture.dispose()
|
||||
skyboxTexture = Texture(skyboxPixmap); skyboxTexture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear)
|
||||
|
||||
if (App.getConfigBoolean("fxdither")) {
|
||||
if (App.getConfigBoolean("fx_dither")) {
|
||||
batch.shader = IngameRenderer.shaderBayer
|
||||
batch.shader.setUniformf("rcount", 64f)
|
||||
batch.shader.setUniformf("gcount", 64f)
|
||||
|
||||
@@ -6,7 +6,7 @@ Text = Tag , Text | PlainText , Text ;
|
||||
Tag = "{" , Code , { TagArgs } , "}" ;
|
||||
TagArgs = " " , Text ;
|
||||
Code = Number | "G" | "P" | "KC" | "SYM" | "NORMAL" | "EMPH" | "VERB" | "RED" | Code , "." , Subcode ;
|
||||
(* KC: keycap. e.g. "{KC config_keyinteract}" | "{KC e}" *)
|
||||
(* KC: keycap. e.g. "{KC control_key_interact}" | "{KC e}" *)
|
||||
(* G: grammatical gender *)
|
||||
(* P: singualr/plural *)
|
||||
(* EMPH: emphasize noun. e.g. "Treasure for the {EMPH}paraglider{NORMAL}. A fair exchange, I believe." *)
|
||||
|
||||
Reference in New Issue
Block a user