mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
config: user-configurable control entries now have config- prefix
This commit is contained in:
@@ -367,13 +367,13 @@ class BuildingMaker(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
// make pen work HERE
|
||||
// when LEFT mouse is down
|
||||
if (!tappedOnUI && Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary")) && !mouseOnUI) {
|
||||
if (!tappedOnUI && Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary")) && !mouseOnUI) {
|
||||
|
||||
makePenWork(Terrarum.mouseTileX, Terrarum.mouseTileY)
|
||||
// TODO drag support using bresenham's algo
|
||||
// for some reason it just doesn't work...
|
||||
}
|
||||
else if (!uiPenMenu.isVisible && Gdx.input.isButtonPressed(AppLoader.getConfigInt("mousesecondary"))) {
|
||||
else if (!uiPenMenu.isVisible && Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mousesecondary"))) {
|
||||
// open pen menu
|
||||
// position the menu to where the cursor is
|
||||
uiPenMenu.posX = Terrarum.mouseScreenX - uiPenMenu.width / 2
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.badlogic.gdx.Input
|
||||
import com.badlogic.gdx.graphics.Camera
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.EMDASH
|
||||
import net.torvald.UnsafeHelper
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.AppLoader.printdbg
|
||||
import net.torvald.terrarum.blockproperties.BlockPropUtil
|
||||
@@ -91,7 +92,7 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
" $EMDASH F: ${Gdx.graphics.framesPerSecond}" +
|
||||
if (AppLoader.IS_DEVELOPMENT_BUILD)
|
||||
" (ΔF${Terrarum.updateRateStr})" +
|
||||
" $EMDASH M: J${Terrarum.memJavaHeap}M / N${Terrarum.memNativeHeap}M / X${Terrarum.memXmx}M"
|
||||
" $EMDASH M: J${Terrarum.memJavaHeap}M / N${Terrarum.memNativeHeap}M / U${Terrarum.memUnsafe}M / X${Terrarum.memXmx}M"
|
||||
else
|
||||
""
|
||||
}
|
||||
@@ -314,8 +315,8 @@ open class TerrarumIngame(batch: SpriteBatch) : IngameInstance(batch) {
|
||||
|
||||
// >- queue up game UIs that should pause the world -<
|
||||
uiInventoryPlayer = UIInventoryFull(actorNowPlaying!!,
|
||||
toggleKeyLiteral = AppLoader.getConfigInt("keyinventory"),
|
||||
toggleButtonLiteral = AppLoader.getConfigInt("gamepadstart")
|
||||
toggleKeyLiteral = AppLoader.getConfigInt("config_keyinventory"),
|
||||
toggleButtonLiteral = AppLoader.getConfigInt("config_gamepadstart")
|
||||
)
|
||||
uiInventoryPlayer.setPosition(0, 0)
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class UIBuildingMakerBlockChooser(val parent: BuildingMaker): UICanvas() {
|
||||
}
|
||||
|
||||
// respond to click
|
||||
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary"))) {
|
||||
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
|
||||
// scroll bar
|
||||
if (relativeMouseX in width - SCROLLBAR_SIZE until width && relativeMouseY in 0 until height) {
|
||||
mouseOnScroll = true
|
||||
|
||||
@@ -99,7 +99,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
|
||||
uiItems.add(button)
|
||||
|
||||
button.clickOnceListener = { _, _, b ->
|
||||
if (b == AppLoader.getConfigInt("mouseprimary")) {
|
||||
if (b == AppLoader.getConfigInt("config_mouseprimary")) {
|
||||
toolButtonsJob[index].invoke()
|
||||
closeGracefully()
|
||||
}
|
||||
@@ -133,7 +133,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
|
||||
}
|
||||
|
||||
// primary click
|
||||
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary"))) {
|
||||
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
|
||||
// close by clicking close button or out-of-boud
|
||||
if (mouseVec.distanceSquared(RADIUS, RADIUS) !in CLOSE_BUTTON_RADIUS.sqr()..RADIUSF.sqr()) {
|
||||
closeGracefully()
|
||||
@@ -163,7 +163,7 @@ class UIBuildingMakerPenMenu(val parent: BuildingMaker): UICanvas() {
|
||||
batch.draw(ItemCodex.getItemImage(slotConfig[i]), x - 16, y - 16, 32f, 32f)
|
||||
|
||||
// update as well while looping
|
||||
if (i == mouseOnBlocksSlot && Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary"))) {
|
||||
if (i == mouseOnBlocksSlot && Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary"))) {
|
||||
parent.setPencilColour(slotConfig[i])
|
||||
closeGracefully()
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.torvald.terrarum.modulebasegame
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.ScreenAdapter
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
@@ -57,8 +58,6 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
||||
}
|
||||
|
||||
override fun render(delta: Float) {
|
||||
//println("WorldgenLoadScreenRender")
|
||||
|
||||
gdxClearAndSetBlend(.094f, .094f, .094f, 0f)
|
||||
|
||||
previewRenderCounter += delta
|
||||
@@ -103,9 +102,6 @@ class WorldgenLoadScreen(screenToBeLoaded: IngameInstance, private val worldwidt
|
||||
|
||||
}
|
||||
|
||||
override fun addMessage(msg: String) {
|
||||
super.addMessage(msg)
|
||||
}
|
||||
|
||||
override fun dispose() {
|
||||
if (!previewPixmap.isDisposed)
|
||||
|
||||
@@ -231,22 +231,22 @@ open class ActorHumanoid(
|
||||
|
||||
private fun updateGamerControlBox() {
|
||||
if (isGamer) {
|
||||
isUpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyup"))
|
||||
isLeftDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyleft"))
|
||||
isDownDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keydown"))
|
||||
isRightDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyright"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump"))
|
||||
isUpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyup"))
|
||||
isLeftDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyleft"))
|
||||
isDownDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keydown"))
|
||||
isRightDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyright"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyjump"))
|
||||
|
||||
val gamepad = AppLoader.gamepad
|
||||
|
||||
if (gamepad != null) {
|
||||
axisX = gamepad.getAxis(AppLoader.getConfigInt("gamepadaxislx"))
|
||||
axisY = gamepad.getAxis(AppLoader.getConfigInt("gamepadaxisly"))
|
||||
axisRX = gamepad.getAxis(AppLoader.getConfigInt("gamepadaxisrx"))
|
||||
axisRY = gamepad.getAxis(AppLoader.getConfigInt("gamepadaxisry"))
|
||||
axisX = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxislx"))
|
||||
axisY = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxisly"))
|
||||
axisRX = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxisrx"))
|
||||
axisRY = gamepad.getAxis(AppLoader.getConfigInt("config_gamepadaxisry"))
|
||||
|
||||
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyjump")) ||
|
||||
gamepad.getButton(AppLoader.getConfigInt("gamepadltrigger"))
|
||||
isJumpDown = Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyjump")) ||
|
||||
gamepad.getButton(AppLoader.getConfigInt("config_gamepadltrigger"))
|
||||
}
|
||||
|
||||
if (isJumpJustDown && jumpJustPressedLatched) {
|
||||
@@ -315,11 +315,11 @@ open class ActorHumanoid(
|
||||
// ↑F, ↓S
|
||||
if (isRightDown && !isLeftDown) {
|
||||
walkHorizontal(false, AXIS_KEYBOARD)
|
||||
prevHMoveKey = AppLoader.getConfigInt("keyright")
|
||||
prevHMoveKey = AppLoader.getConfigInt("config_keyright")
|
||||
} // ↓F, ↑S
|
||||
else if (isLeftDown && !isRightDown) {
|
||||
walkHorizontal(true, AXIS_KEYBOARD)
|
||||
prevHMoveKey = AppLoader.getConfigInt("keyleft")
|
||||
prevHMoveKey = AppLoader.getConfigInt("config_keyleft")
|
||||
} // ↓F, ↓S
|
||||
/*else if (isLeftDown && isRightDown) {
|
||||
if (prevHMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_LEFT)) {
|
||||
@@ -343,11 +343,11 @@ open class ActorHumanoid(
|
||||
// ↑E, ↓D
|
||||
if (isDownDown && !isUpDown) {
|
||||
walkVertical(false, AXIS_KEYBOARD)
|
||||
prevVMoveKey = AppLoader.getConfigInt("keydown")
|
||||
prevVMoveKey = AppLoader.getConfigInt("config_keydown")
|
||||
} // ↓E, ↑D
|
||||
else if (isUpDown && !isDownDown) {
|
||||
walkVertical(true, AXIS_KEYBOARD)
|
||||
prevVMoveKey = AppLoader.getConfigInt("keyup")
|
||||
prevVMoveKey = AppLoader.getConfigInt("config_keyup")
|
||||
} // ↓E, ↓D
|
||||
/*else if (isUpDown && isDownDown) {
|
||||
if (prevVMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_UP)) {
|
||||
|
||||
@@ -38,7 +38,7 @@ class UIBasicInfo(private val player: ActorHumanoid?) : UICanvas() {
|
||||
ELuptimer += delta
|
||||
}
|
||||
|
||||
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyinteract"))) {
|
||||
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyinteract"))) {
|
||||
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("keyleft") // getter used to support in-game keybind changing
|
||||
private val seekRight: Int; get() = AppLoader.getConfigInt("keyright") // getter used to support in-game keybind changing
|
||||
private val seekUp: Int; get() = AppLoader.getConfigInt("keyup") // getter used to support in-game keybind changing
|
||||
private val seekDown: Int; get() = AppLoader.getConfigInt("keydown") // getter used to support in-game keybind changing
|
||||
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
|
||||
|
||||
|
||||
init {
|
||||
|
||||
@@ -42,7 +42,7 @@ class UIInventoryMinimap(val full: UIInventoryFull) : UICanvas() {
|
||||
|
||||
// update map panning
|
||||
// if left click is down and cursor is in the map area
|
||||
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("mouseprimary")) &&
|
||||
if (Gdx.input.isButtonPressed(AppLoader.getConfigInt("config_mouseprimary")) &&
|
||||
Terrarum.mouseScreenY in full.INVENTORY_CELLS_OFFSET_Y..full.INVENTORY_CELLS_OFFSET_Y + full.INVENTORY_CELLS_UI_HEIGHT) {
|
||||
minimapPanX += Terrarum.mouseDeltaX * 2f / minimapZoom
|
||||
minimapPanY += Terrarum.mouseDeltaY * 2f / minimapZoom
|
||||
|
||||
@@ -16,7 +16,7 @@ import net.torvald.terrarum.ui.UICanvas
|
||||
* Created by minjaesong on 2019-08-11.
|
||||
*/
|
||||
class UIScreenZoom : UICanvas(
|
||||
AppLoader.getConfigInt("keyzoom")
|
||||
AppLoader.getConfigInt("config_keyzoom")
|
||||
) {
|
||||
|
||||
val zoomText = "${keyToIcon(handler.toggleKeyLiteral!!)} $EMDASH Zoom Out"
|
||||
|
||||
@@ -47,7 +47,7 @@ class UITierOneWatch(private val player: ActorHumanoid?) : UICanvas() {
|
||||
ELuptimer += delta
|
||||
}
|
||||
|
||||
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("keyinteract"))) {
|
||||
if (mouseUp || Gdx.input.isKeyPressed(AppLoader.getConfigInt("config_keyinteract"))) {
|
||||
ELuptimer = 0f
|
||||
ELon = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user