control help for computer ui

This commit is contained in:
minjaesong
2022-07-01 02:27:06 +09:00
parent 4e98a8c00e
commit 8363b5b4ea
5 changed files with 69 additions and 11 deletions

View File

@@ -13,6 +13,7 @@ import kotlinx.coroutines.launch
import net.torvald.terrarum.*
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.gameactors.BlockBox
import net.torvald.terrarum.modulebasegame.gameactors.FixtureBase
import net.torvald.terrarum.modulebasegame.gameactors.FixtureInventory
@@ -21,8 +22,8 @@ import net.torvald.terrarum.ui.UICanvas
import net.torvald.tsvm.*
import net.torvald.tsvm.peripheral.AdapterConfig
import net.torvald.tsvm.peripheral.GraphicsAdapter
import net.torvald.tsvm.peripheral.ReferenceGraphicsAdapter
import net.torvald.tsvm.peripheral.VMProgramRom
import net.torvald.unicode.*
/**
* Created by minjaesong on 2021-12-04.
@@ -160,6 +161,12 @@ internal class UIHomeComputer : UICanvas(
private val fbo = FrameBuffer(Pixmap.Format.RGBA8888, width, height, false)
private val controlHelp =
"${getKeycapPC(App.getConfigInt("control_key_inventory"))} ${Lang["GAME_ACTION_CLOSE"]}\u3000 " +
"$KEYCAP_CTRL$KEYCAP_SHIFT$KEYCAP_T$KEYCAP_R Terminate\u3000" +
"$KEYCAP_CTRL$KEYCAP_SHIFT$KEYCAP_R$KEYCAP_S Reset\u3000" +
"$KEYCAP_CTRL$KEYCAP_SHIFT$KEYCAP_R$KEYCAP_Q SysRq"
override fun updateUI(delta: Float) {
}
@@ -185,6 +192,8 @@ internal class UIHomeComputer : UICanvas(
otherBatch.draw(fbo.colorBufferTexture, posX.toFloat(), posY.toFloat(), width.toFloat(), height.toFloat())
otherBatch.color = Toolkit.Theme.COL_INACTIVE
Toolkit.drawBoxBorder(otherBatch, posX - 1, posY - 1, width + 2, height + 2)
App.fontGame.draw(otherBatch, controlHelp, posX, posY + height + 4)
}
override fun doOpening(delta: Float) {

View File

@@ -75,8 +75,8 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
get() = if (App.environment == RunningEnvironment.PC)
"${getKeycapPC(App.getConfigInt("control_key_inventory"))} ${Lang["GAME_ACTION_CLOSE"]}"
else
"$gamepadLabelStart ${Lang["GAME_ACTION_CLOSE"]}\u3000" +
"$gamepadLabelLEFTRIGHT ${Lang["GAME_OBJECTIVE_MULTIPLIER"]}\u3000" +
"$gamepadLabelStart ${Lang["GAME_ACTION_CLOSE"]}\u3000 " +
"$gamepadLabelLEFTRIGHT ${Lang["GAME_OBJECTIVE_MULTIPLIER"]}\u3000 " +
"${App.gamepadLabelWest} ${Lang["GAME_ACTION_CRAFT"]}"
private val oldSelectedItems = ArrayList<ItemID>()

View File

@@ -12,8 +12,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.UICrafting
import net.torvald.terrarum.ui.Toolkit
import net.torvald.terrarum.ui.UICanvas
import net.torvald.terrarum.ui.UIItemHorizontalFadeSlide
import net.torvald.unicode.ENDASH
import net.torvald.unicode.getKeycapPC
import net.torvald.unicode.*
/**
* Created by minjaesong on 2017-10-21.
@@ -117,8 +116,8 @@ class UIInventoryFull(
val listControlHelp: String
get() = if (App.environment == RunningEnvironment.PC)
"${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" +
"$KEYCAP_LEFT_MOUSE ${Lang["GAME_INVENTORY_USE"]}$SP" +
"$KEYCAP_1$ENDASH\u2009$KEYCAP_0 ${Lang["GAME_INVENTORY_REGISTER"]}$SP" +
"${getKeycapPC(App.getConfigInt("control_key_discard"))} ${Lang["GAME_INVENTORY_DROP"]}"
else
"$gamepadLabelStart ${Lang["GAME_ACTION_CLOSE"]}$SP" +
@@ -129,15 +128,15 @@ class UIInventoryFull(
"$gamepadLabelEast ${Lang["GAME_INVENTORY_DROP"]}"
val minimapControlHelp: String
get() = if (App.environment == RunningEnvironment.PC)
"${0xe031.toChar()} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
"${0xe006.toChar()}${0xe009.toChar()} ${Lang["GAME_ACTION_MOVE_VERB"]}"
"${getKeycapPC(App.getConfigInt("control_key_inventory"))} ${Lang["GAME_ACTION_CLOSE"]}$SP" +
"$KEYCAP_LEFT_MOUSE$KEYCAP_MOVE ${Lang["GAME_ACTION_MOVE_VERB"]}"
else
"$gamepadLabelStart ${Lang["GAME_ACTION_CLOSE"]}$SP" +
"$gamepadLabelRStick ${Lang["GAME_ACTION_MOVE_VERB"]}$SP" +
"$gamepadLabelRT ${Lang["GAME_INVENTORY"]}"
val gameMenuControlHelp: String
get() = if (App.environment == RunningEnvironment.PC)
"${0xe031.toChar()} ${Lang["GAME_ACTION_CLOSE"]}"
"${getKeycapPC(App.getConfigInt("control_key_inventory"))} ${Lang["GAME_ACTION_CLOSE"]}"
else
"$gamepadLabelStart ${Lang["GAME_ACTION_CLOSE"]}$SP" +
"$gamepadLabelLT ${Lang["GAME_INVENTORY"]}"

View File

@@ -16,6 +16,56 @@ const val EMDASH = 0x2014.toChar()
const val ELLIPSIS = 0x2026.toChar()
const val BULLET = 0x2022.toChar()
const val KEYCAP_SHIFT = 0xE001.toChar()
const val KEYCAP_CAPS = 0xE002.toChar()
const val KEYCAP_TAB = 0xE003.toChar()
const val KEYCAP_DELETE = 0xE004.toChar()
const val KEYCAP_RETURN = 0xE005.toChar()
const val KEYCAP_LEFT_MOUSE = 0xE006.toChar()
const val KEYCAP_RIGHT_MOUSE = 0xE007.toChar()
const val KEYCAP_WHEEL = 0xE008.toChar()
const val KEYCAP_MOVE = 0xE009.toChar()
const val KEYCAP_CTRL = 0xE00A.toChar()
const val KEYCAP_ALT = 0xE00B.toChar()
const val KEYCAP_0 = 0xE010.toChar()
const val KEYCAP_1 = 0xE011.toChar()
const val KEYCAP_2 = 0xE012.toChar()
const val KEYCAP_3 = 0xE013.toChar()
const val KEYCAP_4 = 0xE014.toChar()
const val KEYCAP_5 = 0xE015.toChar()
const val KEYCAP_6 = 0xE016.toChar()
const val KEYCAP_7 = 0xE017.toChar()
const val KEYCAP_8 = 0xE018.toChar()
const val KEYCAP_9 = 0xE019.toChar()
const val KEYCAP_A = 0xE021.toChar()
const val KEYCAP_B = 0xE022.toChar()
const val KEYCAP_C = 0xE023.toChar()
const val KEYCAP_D = 0xE024.toChar()
const val KEYCAP_E = 0xE025.toChar()
const val KEYCAP_F = 0xE026.toChar()
const val KEYCAP_G = 0xE027.toChar()
const val KEYCAP_H = 0xE028.toChar()
const val KEYCAP_I = 0xE029.toChar()
const val KEYCAP_J = 0xE02A.toChar()
const val KEYCAP_K = 0xE02B.toChar()
const val KEYCAP_L = 0xE02C.toChar()
const val KEYCAP_M = 0xE02D.toChar()
const val KEYCAP_N = 0xE02E.toChar()
const val KEYCAP_O = 0xE02F.toChar()
const val KEYCAP_P = 0xE030.toChar()
const val KEYCAP_Q = 0xE031.toChar()
const val KEYCAP_R = 0xE032.toChar()
const val KEYCAP_S = 0xE033.toChar()
const val KEYCAP_T = 0xE034.toChar()
const val KEYCAP_U = 0xE035.toChar()
const val KEYCAP_V = 0xE036.toChar()
const val KEYCAP_W = 0xE037.toChar()
const val KEYCAP_X = 0xE038.toChar()
const val KEYCAP_Y = 0xE039.toChar()
const val KEYCAP_Z = 0xE03A.toChar()
fun getKeycapPC(c: Char) = when (c.uppercaseChar()) {
in ' '..'_' -> (0xE000 + c.code - 32).toChar()
else -> throw IllegalArgumentException("Not in range: ${c.code - 32}")