mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
ISO keylayout on configs
This commit is contained in:
Binary file not shown.
256
assets/keylayout/en_intl_colemak_dh_iso.key
Normal file
256
assets/keylayout/en_intl_colemak_dh_iso.key
Normal file
@@ -0,0 +1,256 @@
|
|||||||
|
{"n":"Colemak Mod\u2013DH ISO","capslock":"back","l":"iso","t":[[""],[undefined],
|
||||||
|
[undefined],
|
||||||
|
["<HOME>"],
|
||||||
|
[undefined],
|
||||||
|
["<CALL>"],
|
||||||
|
["<ENDCALL>"],
|
||||||
|
["0",")","’","”"],
|
||||||
|
["1","!","¡","¹"],
|
||||||
|
["2","@","º","²"],
|
||||||
|
["3","#","ª","³"],
|
||||||
|
["4","$","¢","£"],
|
||||||
|
["5","%","€","¥"],
|
||||||
|
["6","^","ħ","Ħ"],
|
||||||
|
["7","&","ð","Ð"],
|
||||||
|
["8","*","þ","Þ"],
|
||||||
|
["9","(","‘","“"],
|
||||||
|
["*"],
|
||||||
|
["#"],
|
||||||
|
["<UP>"],
|
||||||
|
["<DOWN>"],
|
||||||
|
["<LEFT>"],
|
||||||
|
["<RIGHT>"],
|
||||||
|
["<CENTER>"],
|
||||||
|
["<VOL_UP>"],
|
||||||
|
["<VOL_DOWN>"],
|
||||||
|
["<POWER>"],
|
||||||
|
["<CAMERA>"],
|
||||||
|
["<CLEAR>"],
|
||||||
|
["a","A","á","Á"],
|
||||||
|
["\\","|","¬","¦"],
|
||||||
|
["d","D","\u0308","°"],
|
||||||
|
["s","S","ß","ẞ"],
|
||||||
|
["f","F","ã","Ã"],
|
||||||
|
["t","T","\u0301","\u030B"],
|
||||||
|
["g","G","\u0328","¶"],
|
||||||
|
["m","M","\u0304","µ"],
|
||||||
|
["u","U","ú","Ú"],
|
||||||
|
["n","N","ñ","Ñ"],
|
||||||
|
["e","E","é","É"],
|
||||||
|
["i","I","í","Í"],
|
||||||
|
["h","H","\u030C","±"],
|
||||||
|
["k","K","\u030A","№"],
|
||||||
|
["y","Y","ü","Ü"],
|
||||||
|
[";",":","ö","Ö"],
|
||||||
|
["q","Q","ä","Ä"],
|
||||||
|
["p","P","ø","Ø"],
|
||||||
|
["r","R","\u0300","®"],
|
||||||
|
["b","B","\u0306","©"],
|
||||||
|
["l","L","ł","Ł"],
|
||||||
|
["v","V","œ","Œ"],
|
||||||
|
["w","W","å","Å"],
|
||||||
|
["c","C","ç","Ç"],
|
||||||
|
["j","J","đ","Đ"],
|
||||||
|
["x","X","\u0302","¤"],
|
||||||
|
[",","<","\u0327","·"],
|
||||||
|
[".",">","\u0307","…"],
|
||||||
|
["<ALT_L>"],
|
||||||
|
["<ALT_R>"],
|
||||||
|
["<SHIFT_L>"],
|
||||||
|
["<SHIFT_R>"],
|
||||||
|
["<TAB>"],
|
||||||
|
[" "," ","\u00A0","\u00A0"],
|
||||||
|
["<SYM>"],
|
||||||
|
["<EXPLORER>"],
|
||||||
|
["<ENVELOPE>"],
|
||||||
|
["\n"],
|
||||||
|
["\x08"],
|
||||||
|
["`","~","\u0300","\u0303"],
|
||||||
|
["-","_","–","—"],
|
||||||
|
["=","+","×","÷"],
|
||||||
|
["[","{","«","‹"],
|
||||||
|
["]","}","»","›"],
|
||||||
|
["#","~"],
|
||||||
|
["o","O","ó","Ó"],
|
||||||
|
["'",'"',"õ","Õ"],
|
||||||
|
["/","?","¿","§"],
|
||||||
|
["<AT>"],
|
||||||
|
["<NUM_LOCK>"],
|
||||||
|
["<HEADSETHOOK>"],
|
||||||
|
["<FOCUS>"],
|
||||||
|
["+"],
|
||||||
|
["<MENU>"],
|
||||||
|
["<NOTIFICATION>"],
|
||||||
|
["<SEARCH>"],
|
||||||
|
["<PLAY_PAUSE>"],
|
||||||
|
["<STOP>"],
|
||||||
|
["<NEXT>"],
|
||||||
|
["<PREV>"],
|
||||||
|
["<REW>"],
|
||||||
|
["<FFWD>"],
|
||||||
|
["<MUTE>"],
|
||||||
|
["<PAGE_UP>"],
|
||||||
|
["<PAGE_DOWN>"],
|
||||||
|
["<PICTSYMBOLS>"],
|
||||||
|
["<SWITCH_CHARSET>"],
|
||||||
|
["<:A:>"],
|
||||||
|
["<:B:>"],
|
||||||
|
["<:C:>"],
|
||||||
|
["<:X:>"],
|
||||||
|
["<:Y:>"],
|
||||||
|
["<:Z:>"],
|
||||||
|
["<:L1:>"],
|
||||||
|
["<:R1:>"],
|
||||||
|
["<:L2:>"],
|
||||||
|
["<:R2:>"],
|
||||||
|
["<:TL:>"],
|
||||||
|
["<:TR:>"],
|
||||||
|
["<:START:>"],
|
||||||
|
["<:SELECT:>"],
|
||||||
|
["<:MODE:>"],
|
||||||
|
["<ESC>"],
|
||||||
|
["<DEL>"],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
["<CAPS_LOCK>"],
|
||||||
|
["<SCROLL_LOCK>"],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
["<PRINT_SCREEN_SYS_RQ>"],
|
||||||
|
["<PAUSE_BREAK>"],
|
||||||
|
[undefined],
|
||||||
|
["<END>"],
|
||||||
|
["<INSERT>"],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
["<CTRL_L>"],
|
||||||
|
["<CTRL_R>"],
|
||||||
|
["<F1>"],
|
||||||
|
["<F2>"],
|
||||||
|
["<F3>"],
|
||||||
|
["<F4>"],
|
||||||
|
["<F5>"],
|
||||||
|
["<F6>"],
|
||||||
|
["<F7>"],
|
||||||
|
["<F8>"],
|
||||||
|
["<F9>"],
|
||||||
|
["<F10>"],
|
||||||
|
["<F11>"],
|
||||||
|
["<F12>"],
|
||||||
|
["<NUM_LOCK>"],
|
||||||
|
["0"],
|
||||||
|
["1"],
|
||||||
|
["2"],
|
||||||
|
["3"],
|
||||||
|
["4"],
|
||||||
|
["5"],
|
||||||
|
["6"],
|
||||||
|
["7"],
|
||||||
|
["8"],
|
||||||
|
["9"],
|
||||||
|
["/"],
|
||||||
|
["*"],
|
||||||
|
["-"],
|
||||||
|
["+"],
|
||||||
|
["."],
|
||||||
|
["."],
|
||||||
|
["\n"],
|
||||||
|
["="],
|
||||||
|
["("],
|
||||||
|
[")"],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
["z","Z","æ","Æ"],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
[undefined],
|
||||||
|
["<:CIRCLE:>"]
|
||||||
|
]}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{"n":"FR Bépo","capslock":"shift","t":[[""],[undefined], // NOTE: ISO key that's between LSHIFT and Z (called NUBS on QMK) is not recognised by GDX; NUHS is same as BACKSLASH
|
{"n":"FR Bépo","capslock":"shift","l":"iso","t":[[""],[undefined], // NOTE: ISO key that's between LSHIFT and Z (called NUBS on QMK) is not recognised by GDX; NUHS is same as BACKSLASH
|
||||||
[undefined],
|
[undefined],
|
||||||
["<HOME>"],
|
["<HOME>"],
|
||||||
[undefined],
|
[undefined],
|
||||||
|
|||||||
@@ -15,9 +15,10 @@ typealias Keysymfun = Map<String, String>
|
|||||||
|
|
||||||
|
|
||||||
data class TerrarumKeyLayout(
|
data class TerrarumKeyLayout(
|
||||||
val name: String,
|
val name: String,
|
||||||
val capsMode: TerrarumKeyCapsMode,
|
val capsMode: TerrarumKeyCapsMode,
|
||||||
val symbols: Keysyms
|
val symbols: Keysyms,
|
||||||
|
val physicalLayout: String
|
||||||
)
|
)
|
||||||
|
|
||||||
enum class TerrarumKeyCapsMode {
|
enum class TerrarumKeyCapsMode {
|
||||||
@@ -25,24 +26,24 @@ enum class TerrarumKeyCapsMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data class TerrarumIME(
|
data class TerrarumIME(
|
||||||
val name: String,
|
val name: String,
|
||||||
val config: TerrarumIMEConf,
|
val config: TerrarumIMEConf,
|
||||||
// (headkey, shiftin, altgrin, lowLayerKeysym)
|
// (headkey, shiftin, altgrin, lowLayerKeysym)
|
||||||
val acceptChar: (Int, Boolean, Boolean, String) -> Pair<IMECandidates, IMEOutput>,
|
val acceptChar: (Int, Boolean, Boolean, String) -> Pair<IMECandidates, IMEOutput>,
|
||||||
val backspace: () -> IMECandidates,
|
val backspace: () -> IMECandidates,
|
||||||
val endCompose: () -> IMEOutput,
|
val endCompose: () -> IMEOutput,
|
||||||
val reset: () -> Unit,
|
val reset: () -> Unit,
|
||||||
val composing: () -> Boolean
|
val composing: () -> Boolean
|
||||||
)
|
)
|
||||||
|
|
||||||
data class TerrarumIMEConf(
|
data class TerrarumIMEConf(
|
||||||
val name: String,
|
val name: String,
|
||||||
val copying: String,
|
val copying: String,
|
||||||
val lang: String,
|
val lang: String,
|
||||||
val candidates: TerrarumIMEViewCount,
|
val candidates: TerrarumIMEViewCount,
|
||||||
val symbols: Keysyms?,
|
val symbols: Keysyms?,
|
||||||
val symbolsfun: Keysymfun?,
|
val symbolsfun: Keysymfun?,
|
||||||
val mode: TerrarumIMEMode
|
val mode: TerrarumIMEMode
|
||||||
)
|
)
|
||||||
|
|
||||||
enum class TerrarumIMEViewCount {
|
enum class TerrarumIMEViewCount {
|
||||||
@@ -177,6 +178,12 @@ object IME {
|
|||||||
val jsval = context.eval("js", "'use strict';Object.freeze($src)")
|
val jsval = context.eval("js", "'use strict';Object.freeze($src)")
|
||||||
val name = jsval.getMember("n").asString()
|
val name = jsval.getMember("n").asString()
|
||||||
val capsmode = jsval.getMember("capslock").asString().toCapsMode()
|
val capsmode = jsval.getMember("capslock").asString().toCapsMode()
|
||||||
|
val physicalLayout = try {
|
||||||
|
jsval.getMember("l").asString().lowercase()
|
||||||
|
}
|
||||||
|
catch (e: NullPointerException) {
|
||||||
|
"ansi"
|
||||||
|
}
|
||||||
|
|
||||||
val out = Array(256) { Array<String?>(4) { null } }
|
val out = Array(256) { Array<String?>(4) { null } }
|
||||||
|
|
||||||
@@ -196,7 +203,7 @@ object IME {
|
|||||||
|
|
||||||
// println("[IME] Test Keymap print for $name:"); for (keycode in 0 until 256) { print("$keycode:\t"); println(out[keycode].joinToString("\t")) }
|
// println("[IME] Test Keymap print for $name:"); for (keycode in 0 until 256) { print("$keycode:\t"); println(out[keycode].joinToString("\t")) }
|
||||||
|
|
||||||
return TerrarumKeyLayout(name, capsmode, out)
|
return TerrarumKeyLayout(name, capsmode, out, physicalLayout)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun String.toCanditates(): List<String> =
|
private fun String.toCanditates(): List<String> =
|
||||||
|
|||||||
@@ -2,17 +2,13 @@ package net.torvald.terrarum.modulebasegame.ui
|
|||||||
|
|
||||||
import com.badlogic.gdx.Gdx
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.Input
|
import com.badlogic.gdx.Input
|
||||||
import com.badlogic.gdx.graphics.Camera
|
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.graphics.OrthographicCamera
|
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||||
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.unicode.EMDASH
|
import net.torvald.unicode.EMDASH
|
||||||
import net.torvald.terrarum.App
|
|
||||||
import net.torvald.terrarum.CommonResourcePool
|
|
||||||
import net.torvald.terrarum.ControlPresets
|
|
||||||
import net.torvald.terrarum.gamecontroller.*
|
import net.torvald.terrarum.gamecontroller.*
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
import net.torvald.terrarum.linearSearch
|
|
||||||
import net.torvald.terrarum.ui.*
|
import net.torvald.terrarum.ui.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -20,10 +16,6 @@ import net.torvald.terrarum.ui.*
|
|||||||
*/
|
*/
|
||||||
class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
||||||
|
|
||||||
init {
|
|
||||||
handler.allowESCtoClose = false
|
|
||||||
}
|
|
||||||
|
|
||||||
override var width = 480
|
override var width = 480
|
||||||
override var height = 600
|
override var height = 600
|
||||||
|
|
||||||
@@ -34,81 +26,176 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
internal val kbx = drawX + 1
|
internal val kbx = drawX + 1
|
||||||
internal val kby = drawY + 95
|
internal val kby = drawY + 95
|
||||||
|
|
||||||
private val oneu = 28
|
|
||||||
private val onehalfu = 44
|
|
||||||
private val twou = 52
|
|
||||||
private val twohalfu = 68
|
|
||||||
private val threeu = 84
|
|
||||||
private val spaceu = 188
|
|
||||||
|
|
||||||
private val keycaps = hashMapOf(
|
companion object {
|
||||||
Input.Keys.GRAVE to UIItemInputKeycap(this, 1, 1, Input.Keys.GRAVE, oneu),
|
private val oneu = 28
|
||||||
Input.Keys.NUM_1 to UIItemInputKeycap(this, 33,1, Input.Keys.NUM_1, oneu),
|
private val onequartu = 36
|
||||||
Input.Keys.NUM_2 to UIItemInputKeycap(this, 65,1, Input.Keys.NUM_2, oneu),
|
private val onehalfu = 44
|
||||||
Input.Keys.NUM_3 to UIItemInputKeycap(this, 97,1, Input.Keys.NUM_3, oneu),
|
private val twou = 52
|
||||||
Input.Keys.NUM_4 to UIItemInputKeycap(this, 129,1, Input.Keys.NUM_4, oneu),
|
private val twoquartu = 60
|
||||||
Input.Keys.NUM_5 to UIItemInputKeycap(this, 161,1, Input.Keys.NUM_5, oneu),
|
private val twohalfu = 68
|
||||||
Input.Keys.NUM_6 to UIItemInputKeycap(this, 193,1, Input.Keys.NUM_6, oneu),
|
private val threeu = 84
|
||||||
Input.Keys.NUM_7 to UIItemInputKeycap(this, 225,1, Input.Keys.NUM_7, oneu),
|
private val spaceu = 188
|
||||||
Input.Keys.NUM_8 to UIItemInputKeycap(this, 257,1, Input.Keys.NUM_8, oneu),
|
|
||||||
Input.Keys.NUM_9 to UIItemInputKeycap(this, 289,1, Input.Keys.NUM_9, oneu),
|
|
||||||
Input.Keys.NUM_0 to UIItemInputKeycap(this, 321,1, Input.Keys.NUM_0, oneu),
|
|
||||||
Input.Keys.MINUS to UIItemInputKeycap(this, 353,1, Input.Keys.MINUS, oneu),
|
|
||||||
Input.Keys.EQUALS to UIItemInputKeycap(this, 385,1, Input.Keys.EQUALS, oneu),
|
|
||||||
Input.Keys.BACKSPACE to UIItemInputKeycap(this, 417,1, Input.Keys.BACKSPACE, 60),
|
|
||||||
|
|
||||||
Input.Keys.TAB to UIItemInputKeycap(this, 1,33, Input.Keys.TAB, onehalfu),
|
private fun getKeycapsANSI(parent: UIIMEConfig) = hashMapOf(
|
||||||
Input.Keys.Q to UIItemInputKeycap(this, 49,33, Input.Keys.Q, oneu),
|
Input.Keys.GRAVE to UIItemInputKeycap(parent, 1, 1, Input.Keys.GRAVE, oneu),
|
||||||
Input.Keys.W to UIItemInputKeycap(this, 81,33, Input.Keys.W, oneu),
|
Input.Keys.NUM_1 to UIItemInputKeycap(parent, 33,1, Input.Keys.NUM_1, oneu),
|
||||||
Input.Keys.E to UIItemInputKeycap(this, 113,33, Input.Keys.E, oneu),
|
Input.Keys.NUM_2 to UIItemInputKeycap(parent, 65,1, Input.Keys.NUM_2, oneu),
|
||||||
Input.Keys.R to UIItemInputKeycap(this, 145,33, Input.Keys.R, oneu),
|
Input.Keys.NUM_3 to UIItemInputKeycap(parent, 97,1, Input.Keys.NUM_3, oneu),
|
||||||
Input.Keys.T to UIItemInputKeycap(this, 177,33, Input.Keys.T, oneu),
|
Input.Keys.NUM_4 to UIItemInputKeycap(parent, 129,1, Input.Keys.NUM_4, oneu),
|
||||||
Input.Keys.Y to UIItemInputKeycap(this, 209,33, Input.Keys.Y, oneu),
|
Input.Keys.NUM_5 to UIItemInputKeycap(parent, 161,1, Input.Keys.NUM_5, oneu),
|
||||||
Input.Keys.U to UIItemInputKeycap(this, 241,33, Input.Keys.U, oneu),
|
Input.Keys.NUM_6 to UIItemInputKeycap(parent, 193,1, Input.Keys.NUM_6, oneu),
|
||||||
Input.Keys.I to UIItemInputKeycap(this, 273,33, Input.Keys.I, oneu),
|
Input.Keys.NUM_7 to UIItemInputKeycap(parent, 225,1, Input.Keys.NUM_7, oneu),
|
||||||
Input.Keys.O to UIItemInputKeycap(this, 305,33, Input.Keys.O, oneu),
|
Input.Keys.NUM_8 to UIItemInputKeycap(parent, 257,1, Input.Keys.NUM_8, oneu),
|
||||||
Input.Keys.P to UIItemInputKeycap(this, 337,33, Input.Keys.P, oneu),
|
Input.Keys.NUM_9 to UIItemInputKeycap(parent, 289,1, Input.Keys.NUM_9, oneu),
|
||||||
Input.Keys.LEFT_BRACKET to UIItemInputKeycap(this, 369,33, Input.Keys.LEFT_BRACKET, oneu),
|
Input.Keys.NUM_0 to UIItemInputKeycap(parent, 321,1, Input.Keys.NUM_0, oneu),
|
||||||
Input.Keys.RIGHT_BRACKET to UIItemInputKeycap(this, 401,33, Input.Keys.RIGHT_BRACKET, oneu),
|
Input.Keys.MINUS to UIItemInputKeycap(parent, 353,1, Input.Keys.MINUS, oneu),
|
||||||
Input.Keys.BACKSLASH to UIItemInputKeycap(this, 433,33, Input.Keys.BACKSLASH, onehalfu),
|
Input.Keys.EQUALS to UIItemInputKeycap(parent, 385,1, Input.Keys.EQUALS, oneu),
|
||||||
|
Input.Keys.BACKSPACE to UIItemInputKeycap(parent, 417,1, Input.Keys.BACKSPACE, twoquartu),
|
||||||
|
|
||||||
Input.Keys.CAPS_LOCK to UIItemInputKeycap(this, 1,65, Input.Keys.CAPS_LOCK, twou),
|
Input.Keys.TAB to UIItemInputKeycap(parent, 1,33, Input.Keys.TAB, onehalfu),
|
||||||
Input.Keys.A to UIItemInputKeycap(this, 57,65, Input.Keys.A, oneu),
|
Input.Keys.Q to UIItemInputKeycap(parent, 49,33, Input.Keys.Q, oneu),
|
||||||
Input.Keys.S to UIItemInputKeycap(this, 89,65, Input.Keys.S, oneu),
|
Input.Keys.W to UIItemInputKeycap(parent, 81,33, Input.Keys.W, oneu),
|
||||||
Input.Keys.D to UIItemInputKeycap(this, 121,65, Input.Keys.D, oneu),
|
Input.Keys.E to UIItemInputKeycap(parent, 113,33, Input.Keys.E, oneu),
|
||||||
Input.Keys.F to UIItemInputKeycap(this, 153,65, Input.Keys.F, oneu, true),
|
Input.Keys.R to UIItemInputKeycap(parent, 145,33, Input.Keys.R, oneu),
|
||||||
Input.Keys.G to UIItemInputKeycap(this, 185,65, Input.Keys.G, oneu),
|
Input.Keys.T to UIItemInputKeycap(parent, 177,33, Input.Keys.T, oneu),
|
||||||
Input.Keys.H to UIItemInputKeycap(this, 217,65, Input.Keys.H, oneu),
|
Input.Keys.Y to UIItemInputKeycap(parent, 209,33, Input.Keys.Y, oneu),
|
||||||
Input.Keys.J to UIItemInputKeycap(this, 249,65, Input.Keys.J, oneu, true),
|
Input.Keys.U to UIItemInputKeycap(parent, 241,33, Input.Keys.U, oneu),
|
||||||
Input.Keys.K to UIItemInputKeycap(this, 281,65, Input.Keys.K, oneu),
|
Input.Keys.I to UIItemInputKeycap(parent, 273,33, Input.Keys.I, oneu),
|
||||||
Input.Keys.L to UIItemInputKeycap(this, 313,65, Input.Keys.L, oneu),
|
Input.Keys.O to UIItemInputKeycap(parent, 305,33, Input.Keys.O, oneu),
|
||||||
Input.Keys.SEMICOLON to UIItemInputKeycap(this, 345,65, Input.Keys.SEMICOLON, oneu),
|
Input.Keys.P to UIItemInputKeycap(parent, 337,33, Input.Keys.P, oneu),
|
||||||
Input.Keys.APOSTROPHE to UIItemInputKeycap(this, 377,65, Input.Keys.APOSTROPHE, oneu),
|
Input.Keys.LEFT_BRACKET to UIItemInputKeycap(parent, 369,33, Input.Keys.LEFT_BRACKET, oneu),
|
||||||
Input.Keys.ENTER to UIItemInputKeycap(this, 409,65, Input.Keys.ENTER, twohalfu),
|
Input.Keys.RIGHT_BRACKET to UIItemInputKeycap(parent, 401,33, Input.Keys.RIGHT_BRACKET, oneu),
|
||||||
|
Input.Keys.BACKSLASH to UIItemInputKeycap(parent, 433,33, Input.Keys.BACKSLASH, onehalfu),
|
||||||
|
|
||||||
Input.Keys.SHIFT_LEFT to UIItemInputKeycap(this, 1,97, Input.Keys.SHIFT_LEFT, twohalfu),
|
Input.Keys.CAPS_LOCK to UIItemInputKeycap(parent, 1,65, Input.Keys.CAPS_LOCK, twou),
|
||||||
Input.Keys.Z to UIItemInputKeycap(this, 73,97, Input.Keys.Z, oneu),
|
Input.Keys.A to UIItemInputKeycap(parent, 57,65, Input.Keys.A, oneu),
|
||||||
Input.Keys.X to UIItemInputKeycap(this, 105,97, Input.Keys.X, oneu),
|
Input.Keys.S to UIItemInputKeycap(parent, 89,65, Input.Keys.S, oneu),
|
||||||
Input.Keys.C to UIItemInputKeycap(this, 137,97, Input.Keys.C, oneu),
|
Input.Keys.D to UIItemInputKeycap(parent, 121,65, Input.Keys.D, oneu),
|
||||||
Input.Keys.V to UIItemInputKeycap(this, 169,97, Input.Keys.V, oneu),
|
Input.Keys.F to UIItemInputKeycap(parent, 153,65, Input.Keys.F, oneu, true),
|
||||||
Input.Keys.B to UIItemInputKeycap(this, 201,97, Input.Keys.B, oneu),
|
Input.Keys.G to UIItemInputKeycap(parent, 185,65, Input.Keys.G, oneu),
|
||||||
Input.Keys.N to UIItemInputKeycap(this, 233,97, Input.Keys.N, oneu),
|
Input.Keys.H to UIItemInputKeycap(parent, 217,65, Input.Keys.H, oneu),
|
||||||
Input.Keys.M to UIItemInputKeycap(this, 265,97, Input.Keys.M, oneu),
|
Input.Keys.J to UIItemInputKeycap(parent, 249,65, Input.Keys.J, oneu, true),
|
||||||
Input.Keys.COMMA to UIItemInputKeycap(this, 297,97, Input.Keys.COMMA, oneu),
|
Input.Keys.K to UIItemInputKeycap(parent, 281,65, Input.Keys.K, oneu),
|
||||||
Input.Keys.PERIOD to UIItemInputKeycap(this, 329,97, Input.Keys.PERIOD, oneu),
|
Input.Keys.L to UIItemInputKeycap(parent, 313,65, Input.Keys.L, oneu),
|
||||||
Input.Keys.SLASH to UIItemInputKeycap(this, 361,97, Input.Keys.SLASH, oneu),
|
Input.Keys.SEMICOLON to UIItemInputKeycap(parent, 345,65, Input.Keys.SEMICOLON, oneu),
|
||||||
Input.Keys.SHIFT_RIGHT to UIItemInputKeycap(this, 393,97, Input.Keys.SHIFT_RIGHT, threeu),
|
Input.Keys.APOSTROPHE to UIItemInputKeycap(parent, 377,65, Input.Keys.APOSTROPHE, oneu),
|
||||||
|
Input.Keys.ENTER to UIItemInputKeycap(parent, 409,65, Input.Keys.ENTER, twohalfu),
|
||||||
|
|
||||||
Input.Keys.CONTROL_LEFT to UIItemInputKeycap(this, 1,129, Input.Keys.CONTROL_LEFT, onehalfu),
|
Input.Keys.SHIFT_LEFT to UIItemInputKeycap(parent, 1,97, Input.Keys.SHIFT_LEFT, twohalfu),
|
||||||
-2 to UIItemInputKeycap(this, 49,129, null, oneu),
|
Input.Keys.Z to UIItemInputKeycap(parent, 73,97, Input.Keys.Z, oneu),
|
||||||
Input.Keys.ALT_LEFT to UIItemInputKeycap(this, 81,129, Input.Keys.ALT_LEFT, onehalfu),
|
Input.Keys.X to UIItemInputKeycap(parent, 105,97, Input.Keys.X, oneu),
|
||||||
Input.Keys.SPACE to UIItemInputKeycap(this, 129,129, Input.Keys.SPACE, spaceu),
|
Input.Keys.C to UIItemInputKeycap(parent, 137,97, Input.Keys.C, oneu),
|
||||||
Input.Keys.ALT_RIGHT to UIItemInputKeycap(this, 321,129, Input.Keys.ALT_RIGHT, onehalfu),
|
Input.Keys.V to UIItemInputKeycap(parent, 169,97, Input.Keys.V, oneu),
|
||||||
-3 to UIItemInputKeycap(this, 369,129, null, oneu),
|
Input.Keys.B to UIItemInputKeycap(parent, 201,97, Input.Keys.B, oneu),
|
||||||
-4 to UIItemInputKeycap(this, 401,129, null, oneu),
|
Input.Keys.N to UIItemInputKeycap(parent, 233,97, Input.Keys.N, oneu),
|
||||||
Input.Keys.CONTROL_RIGHT to UIItemInputKeycap(this, 433,129, Input.Keys.CONTROL_RIGHT, onehalfu),
|
Input.Keys.M to UIItemInputKeycap(parent, 265,97, Input.Keys.M, oneu),
|
||||||
|
Input.Keys.COMMA to UIItemInputKeycap(parent, 297,97, Input.Keys.COMMA, oneu),
|
||||||
|
Input.Keys.PERIOD to UIItemInputKeycap(parent, 329,97, Input.Keys.PERIOD, oneu),
|
||||||
|
Input.Keys.SLASH to UIItemInputKeycap(parent, 361,97, Input.Keys.SLASH, oneu),
|
||||||
|
Input.Keys.SHIFT_RIGHT to UIItemInputKeycap(parent, 393,97, Input.Keys.SHIFT_RIGHT, threeu),
|
||||||
|
|
||||||
) // end of keycaps
|
Input.Keys.CONTROL_LEFT to UIItemInputKeycap(parent, 1,129, Input.Keys.CONTROL_LEFT, onehalfu),
|
||||||
|
-2 to UIItemInputKeycap(parent, 49,129, null, oneu),
|
||||||
|
Input.Keys.ALT_LEFT to UIItemInputKeycap(parent, 81,129, Input.Keys.ALT_LEFT, onehalfu),
|
||||||
|
Input.Keys.SPACE to UIItemInputKeycap(parent, 129,129, Input.Keys.SPACE, spaceu),
|
||||||
|
Input.Keys.ALT_RIGHT to UIItemInputKeycap(parent, 321,129, Input.Keys.ALT_RIGHT, onehalfu),
|
||||||
|
-3 to UIItemInputKeycap(parent, 369,129, null, oneu),
|
||||||
|
-4 to UIItemInputKeycap(parent, 401,129, null, oneu),
|
||||||
|
Input.Keys.CONTROL_RIGHT to UIItemInputKeycap(parent, 433,129, Input.Keys.CONTROL_RIGHT, onehalfu),
|
||||||
|
|
||||||
|
) // end of keycaps
|
||||||
|
|
||||||
|
|
||||||
|
private fun getKeycapsISO(parent: UIIMEConfig) = hashMapOf(
|
||||||
|
Input.Keys.GRAVE to UIItemInputKeycap(parent, 1, 1, Input.Keys.GRAVE, oneu),
|
||||||
|
Input.Keys.NUM_1 to UIItemInputKeycap(parent, 33,1, Input.Keys.NUM_1, oneu),
|
||||||
|
Input.Keys.NUM_2 to UIItemInputKeycap(parent, 65,1, Input.Keys.NUM_2, oneu),
|
||||||
|
Input.Keys.NUM_3 to UIItemInputKeycap(parent, 97,1, Input.Keys.NUM_3, oneu),
|
||||||
|
Input.Keys.NUM_4 to UIItemInputKeycap(parent, 129,1, Input.Keys.NUM_4, oneu),
|
||||||
|
Input.Keys.NUM_5 to UIItemInputKeycap(parent, 161,1, Input.Keys.NUM_5, oneu),
|
||||||
|
Input.Keys.NUM_6 to UIItemInputKeycap(parent, 193,1, Input.Keys.NUM_6, oneu),
|
||||||
|
Input.Keys.NUM_7 to UIItemInputKeycap(parent, 225,1, Input.Keys.NUM_7, oneu),
|
||||||
|
Input.Keys.NUM_8 to UIItemInputKeycap(parent, 257,1, Input.Keys.NUM_8, oneu),
|
||||||
|
Input.Keys.NUM_9 to UIItemInputKeycap(parent, 289,1, Input.Keys.NUM_9, oneu),
|
||||||
|
Input.Keys.NUM_0 to UIItemInputKeycap(parent, 321,1, Input.Keys.NUM_0, oneu),
|
||||||
|
Input.Keys.MINUS to UIItemInputKeycap(parent, 353,1, Input.Keys.MINUS, oneu),
|
||||||
|
Input.Keys.EQUALS to UIItemInputKeycap(parent, 385,1, Input.Keys.EQUALS, oneu),
|
||||||
|
Input.Keys.BACKSPACE to UIItemInputKeycap(parent, 417,1, Input.Keys.BACKSPACE, twoquartu),
|
||||||
|
|
||||||
|
Input.Keys.TAB to UIItemInputKeycap(parent, 1,33, Input.Keys.TAB, onehalfu),
|
||||||
|
Input.Keys.Q to UIItemInputKeycap(parent, 49,33, Input.Keys.Q, oneu),
|
||||||
|
Input.Keys.W to UIItemInputKeycap(parent, 81,33, Input.Keys.W, oneu),
|
||||||
|
Input.Keys.E to UIItemInputKeycap(parent, 113,33, Input.Keys.E, oneu),
|
||||||
|
Input.Keys.R to UIItemInputKeycap(parent, 145,33, Input.Keys.R, oneu),
|
||||||
|
Input.Keys.T to UIItemInputKeycap(parent, 177,33, Input.Keys.T, oneu),
|
||||||
|
Input.Keys.Y to UIItemInputKeycap(parent, 209,33, Input.Keys.Y, oneu),
|
||||||
|
Input.Keys.U to UIItemInputKeycap(parent, 241,33, Input.Keys.U, oneu),
|
||||||
|
Input.Keys.I to UIItemInputKeycap(parent, 273,33, Input.Keys.I, oneu),
|
||||||
|
Input.Keys.O to UIItemInputKeycap(parent, 305,33, Input.Keys.O, oneu),
|
||||||
|
Input.Keys.P to UIItemInputKeycap(parent, 337,33, Input.Keys.P, oneu),
|
||||||
|
Input.Keys.LEFT_BRACKET to UIItemInputKeycap(parent, 369,33, Input.Keys.LEFT_BRACKET, oneu),
|
||||||
|
Input.Keys.RIGHT_BRACKET to UIItemInputKeycap(parent, 401,33, Input.Keys.RIGHT_BRACKET, oneu),
|
||||||
|
Input.Keys.ENTER to UIItemInputKeycapTwoRowRight(parent, 433,33, Input.Keys.ENTER, onehalfu, onequartu),
|
||||||
|
|
||||||
|
Input.Keys.CAPS_LOCK to UIItemInputKeycap(parent, 1,65, Input.Keys.CAPS_LOCK, twou),
|
||||||
|
Input.Keys.A to UIItemInputKeycap(parent, 57,65, Input.Keys.A, oneu),
|
||||||
|
Input.Keys.S to UIItemInputKeycap(parent, 89,65, Input.Keys.S, oneu),
|
||||||
|
Input.Keys.D to UIItemInputKeycap(parent, 121,65, Input.Keys.D, oneu),
|
||||||
|
Input.Keys.F to UIItemInputKeycap(parent, 153,65, Input.Keys.F, oneu, true),
|
||||||
|
Input.Keys.G to UIItemInputKeycap(parent, 185,65, Input.Keys.G, oneu),
|
||||||
|
Input.Keys.H to UIItemInputKeycap(parent, 217,65, Input.Keys.H, oneu),
|
||||||
|
Input.Keys.J to UIItemInputKeycap(parent, 249,65, Input.Keys.J, oneu, true),
|
||||||
|
Input.Keys.K to UIItemInputKeycap(parent, 281,65, Input.Keys.K, oneu),
|
||||||
|
Input.Keys.L to UIItemInputKeycap(parent, 313,65, Input.Keys.L, oneu),
|
||||||
|
Input.Keys.SEMICOLON to UIItemInputKeycap(parent, 345,65, Input.Keys.SEMICOLON, oneu),
|
||||||
|
Input.Keys.APOSTROPHE to UIItemInputKeycap(parent, 377,65, Input.Keys.APOSTROPHE, oneu),
|
||||||
|
Input.Keys.BACKSLASH to UIItemInputKeycap(parent, 409,65, Input.Keys.BACKSLASH, oneu),
|
||||||
|
|
||||||
|
Input.Keys.SHIFT_LEFT to UIItemInputKeycap(parent, 1,97, Input.Keys.SHIFT_LEFT, onequartu),
|
||||||
|
Input.Keys.WORLD_1 to UIItemInputKeycap(parent, 41,97, Input.Keys.WORLD_1, oneu),
|
||||||
|
Input.Keys.Z to UIItemInputKeycap(parent, 73,97, Input.Keys.Z, oneu),
|
||||||
|
Input.Keys.X to UIItemInputKeycap(parent, 105,97, Input.Keys.X, oneu),
|
||||||
|
Input.Keys.C to UIItemInputKeycap(parent, 137,97, Input.Keys.C, oneu),
|
||||||
|
Input.Keys.V to UIItemInputKeycap(parent, 169,97, Input.Keys.V, oneu),
|
||||||
|
Input.Keys.B to UIItemInputKeycap(parent, 201,97, Input.Keys.B, oneu),
|
||||||
|
Input.Keys.N to UIItemInputKeycap(parent, 233,97, Input.Keys.N, oneu),
|
||||||
|
Input.Keys.M to UIItemInputKeycap(parent, 265,97, Input.Keys.M, oneu),
|
||||||
|
Input.Keys.COMMA to UIItemInputKeycap(parent, 297,97, Input.Keys.COMMA, oneu),
|
||||||
|
Input.Keys.PERIOD to UIItemInputKeycap(parent, 329,97, Input.Keys.PERIOD, oneu),
|
||||||
|
Input.Keys.SLASH to UIItemInputKeycap(parent, 361,97, Input.Keys.SLASH, oneu),
|
||||||
|
Input.Keys.SHIFT_RIGHT to UIItemInputKeycap(parent, 393,97, Input.Keys.SHIFT_RIGHT, threeu),
|
||||||
|
|
||||||
|
Input.Keys.CONTROL_LEFT to UIItemInputKeycap(parent, 1,129, Input.Keys.CONTROL_LEFT, onehalfu),
|
||||||
|
-2 to UIItemInputKeycap(parent, 49,129, null, oneu),
|
||||||
|
Input.Keys.ALT_LEFT to UIItemInputKeycap(parent, 81,129, Input.Keys.ALT_LEFT, onehalfu),
|
||||||
|
Input.Keys.SPACE to UIItemInputKeycap(parent, 129,129, Input.Keys.SPACE, spaceu),
|
||||||
|
Input.Keys.ALT_RIGHT to UIItemInputKeycap(parent, 321,129, Input.Keys.ALT_RIGHT, onehalfu),
|
||||||
|
-3 to UIItemInputKeycap(parent, 369,129, null, oneu),
|
||||||
|
-4 to UIItemInputKeycap(parent, 401,129, null, oneu),
|
||||||
|
Input.Keys.CONTROL_RIGHT to UIItemInputKeycap(parent, 433,129, Input.Keys.CONTROL_RIGHT, onehalfu),
|
||||||
|
|
||||||
|
) // end of keycaps
|
||||||
|
}
|
||||||
|
|
||||||
|
private lateinit var keycaps: HashMap<Int, UIItemInputKeycap>
|
||||||
|
|
||||||
|
init {
|
||||||
|
handler.allowESCtoClose = false
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun refreshKeycaps(layout: String) {
|
||||||
|
if (::keycaps.isInitialized)
|
||||||
|
keycaps.values.forEach { removeUIitem(it) }
|
||||||
|
|
||||||
|
keycaps = when (layout) {
|
||||||
|
"ansi" -> getKeycapsANSI(this)
|
||||||
|
"iso" -> getKeycapsISO(this)
|
||||||
|
else -> throw IllegalArgumentException("Unknown physical layout: $layout")
|
||||||
|
}
|
||||||
|
|
||||||
|
keycaps.values.forEach { addUIitemAtHead(it) }
|
||||||
|
}
|
||||||
|
|
||||||
private val textSelWidth = 266
|
private val textSelWidth = 266
|
||||||
private val selectorWidth = 600
|
private val selectorWidth = 600
|
||||||
@@ -149,8 +236,10 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
private var oldPhysicalLayout = IME.getLowLayerByName(App.getConfigString("basekeyboardlayout")).physicalLayout
|
||||||
|
|
||||||
init {
|
init {
|
||||||
keycaps.values.forEach { addUIitem(it) }
|
refreshKeycaps(oldPhysicalLayout)
|
||||||
|
|
||||||
|
|
||||||
keyboardLayoutSelection.selectionChangeListener = {
|
keyboardLayoutSelection.selectionChangeListener = {
|
||||||
@@ -204,6 +293,16 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
altgrin = Gdx.input.isKeyPressed(Input.Keys.ALT_RIGHT) || (Gdx.input.isKeyPressed(Input.Keys.ALT_LEFT) && Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
|
altgrin = Gdx.input.isKeyPressed(Input.Keys.ALT_RIGHT) || (Gdx.input.isKeyPressed(Input.Keys.ALT_LEFT) && Gdx.input.isKeyPressed(Input.Keys.CONTROL_LEFT))
|
||||||
lowlayer = IME.getLowLayerByName(App.getConfigString("basekeyboardlayout"))
|
lowlayer = IME.getLowLayerByName(App.getConfigString("basekeyboardlayout"))
|
||||||
highlayer = getIME()
|
highlayer = getIME()
|
||||||
|
|
||||||
|
detectLowLayerChange()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun detectLowLayerChange() {
|
||||||
|
val newPhysicalLayout = IME.getLowLayerByName(App.getConfigString("basekeyboardlayout")).physicalLayout
|
||||||
|
if (newPhysicalLayout != oldPhysicalLayout) {
|
||||||
|
oldPhysicalLayout = newPhysicalLayout
|
||||||
|
refreshKeycaps(newPhysicalLayout)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal var shiftin = false; private set
|
internal var shiftin = false; private set
|
||||||
@@ -232,7 +331,7 @@ class UIIMEConfig(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
/**
|
/**
|
||||||
* @param key LibGDX keycode. Set it to `null` to "disable" the key. Also see [com.badlogic.gdx.Input.Keys]
|
* @param key LibGDX keycode. Set it to `null` to "disable" the key. Also see [com.badlogic.gdx.Input.Keys]
|
||||||
*/
|
*/
|
||||||
private class UIItemInputKeycap(
|
open private class UIItemInputKeycap(
|
||||||
val parent: UIIMEConfig,
|
val parent: UIIMEConfig,
|
||||||
initialX: Int,
|
initialX: Int,
|
||||||
initialY: Int,
|
initialY: Int,
|
||||||
@@ -248,20 +347,20 @@ private class UIItemInputKeycap(
|
|||||||
|
|
||||||
override val height = 28
|
override val height = 28
|
||||||
|
|
||||||
private val labels = CommonResourcePool.getAsTextureRegionPack("inventory_category")
|
protected val labels = CommonResourcePool.getAsTextureRegionPack("inventory_category")
|
||||||
|
|
||||||
var selected = false
|
var selected = false
|
||||||
|
|
||||||
private val borderKeyForbidden = Color(0x000000C0)
|
protected val borderKeyForbidden = Color(0x000000C0)
|
||||||
private val borderKeyNormal = Toolkit.Theme.COL_INACTIVE
|
protected val borderKeyNormal = Toolkit.Theme.COL_INACTIVE
|
||||||
private val borderMouseUp = Toolkit.Theme.COL_MOUSE_UP
|
protected val borderMouseUp = Toolkit.Theme.COL_MOUSE_UP
|
||||||
private val borderKeyPressed = Toolkit.Theme.COL_SELECTED
|
protected val borderKeyPressed = Toolkit.Theme.COL_SELECTED
|
||||||
private val borderKeyPressedAndSelected = Color(0x33FF33FF.toInt())
|
protected val borderKeyPressedAndSelected = Color(0x33FF33FF.toInt())
|
||||||
|
|
||||||
private val keycapFill = Toolkit.Theme.COL_CELL_FILL
|
protected val keycapFill = Toolkit.Theme.COL_CELL_FILL
|
||||||
|
|
||||||
private val keylabelCol = Color(0xddddddff.toInt())
|
protected val keylabelCol = Color(0xddddddff.toInt())
|
||||||
private val configuredKeyCol = Color.WHITE
|
protected val configuredKeyCol = Color.WHITE
|
||||||
|
|
||||||
override fun update(delta: Float) {
|
override fun update(delta: Float) {
|
||||||
super.update(delta)
|
super.update(delta)
|
||||||
@@ -271,58 +370,62 @@ private class UIItemInputKeycap(
|
|||||||
c in 0x1DC0..0x1DFF || c in 0x20D0..0x20FF || c in 0xFE20..0xFE2F ||
|
c in 0x1DC0..0x1DFF || c in 0x20D0..0x20FF || c in 0xFE20..0xFE2F ||
|
||||||
c == 0xE31 || c in 0xE33..0xE3A || c in 0xE47..0xE4E
|
c == 0xE31 || c in 0xE33..0xE3A || c in 0xE47..0xE4E
|
||||||
|
|
||||||
override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
|
protected fun getBorderCol() = if (key == null)
|
||||||
super.render(frameDelta, batch, camera)
|
borderKeyForbidden
|
||||||
|
else if (Gdx.input.isKeyPressed(key))
|
||||||
|
borderKeyPressed
|
||||||
|
else
|
||||||
|
borderKeyNormal
|
||||||
|
|
||||||
|
protected open fun drawKeycap(batch: SpriteBatch) {
|
||||||
// key background
|
// key background
|
||||||
batch.color = keycapFill
|
batch.color = keycapFill
|
||||||
Toolkit.fillArea(batch, posX, posY, width, height)
|
Toolkit.fillArea(batch, posX, posY, width, height)
|
||||||
|
|
||||||
batch.color = if (key == null)
|
|
||||||
borderKeyForbidden
|
|
||||||
else if (Gdx.input.isKeyPressed(key))
|
|
||||||
borderKeyPressed
|
|
||||||
else
|
|
||||||
borderKeyNormal
|
|
||||||
|
|
||||||
// key border
|
// key border
|
||||||
|
batch.color = getBorderCol()
|
||||||
Toolkit.drawBoxBorder(batch, posX, posY, width, height)
|
Toolkit.drawBoxBorder(batch, posX, posY, width, height)
|
||||||
|
if (homerow) Toolkit.drawBoxBorder(batch, posX + 9, posY + 26, 10, 1)
|
||||||
|
}
|
||||||
|
|
||||||
if (homerow) {
|
protected open fun getKeysymPos() = (posX + (width - 20) / 2).toFloat() to posY + 4f
|
||||||
Toolkit.drawBoxBorder(batch, posX + 9, posY + 26, 10, 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
override fun render(frameDelta: Float, batch: SpriteBatch, camera: OrthographicCamera) {
|
||||||
|
super.render(frameDelta, batch, camera)
|
||||||
|
|
||||||
|
drawKeycap(batch)
|
||||||
|
val (symx, symy) = getKeysymPos()
|
||||||
|
|
||||||
// keysym
|
// keysym
|
||||||
if (key == Input.Keys.CONTROL_LEFT || key == Input.Keys.CONTROL_RIGHT)
|
if (key == Input.Keys.CONTROL_LEFT || key == Input.Keys.CONTROL_RIGHT)
|
||||||
batch.draw(labels.get(21,3), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(21,3), symx, symy)
|
||||||
else if (key == Input.Keys.ALT_LEFT)
|
else if (key == Input.Keys.ALT_LEFT)
|
||||||
batch.draw(labels.get(22,3), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(22,3), symx, symy)
|
||||||
else if (key == Input.Keys.ALT_RIGHT)
|
else if (key == Input.Keys.ALT_RIGHT)
|
||||||
batch.draw(labels.get(23,2), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(23,2), symx, symy)
|
||||||
else if (key == Input.Keys.SHIFT_LEFT || key == Input.Keys.SHIFT_RIGHT)
|
else if (key == Input.Keys.SHIFT_LEFT || key == Input.Keys.SHIFT_RIGHT)
|
||||||
batch.draw(labels.get(23,3), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(23,3), symx, symy)
|
||||||
else if (key == Input.Keys.TAB)
|
else if (key == Input.Keys.TAB)
|
||||||
batch.draw(labels.get(23,5), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(23,5), symx, symy)
|
||||||
else if (key == Input.Keys.BACKSPACE)
|
else if (key == Input.Keys.BACKSPACE)
|
||||||
batch.draw(labels.get(24,5), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(24,5), symx, symy)
|
||||||
else if (key == Input.Keys.CAPS_LOCK) {
|
else if (key == Input.Keys.CAPS_LOCK) {
|
||||||
if (parent.lowlayer.capsMode == TerrarumKeyCapsMode.CAPS)
|
if (parent.lowlayer.capsMode == TerrarumKeyCapsMode.CAPS)
|
||||||
batch.draw(labels.get(24,3), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(24,3), symx, symy)
|
||||||
else if (parent.lowlayer.capsMode == TerrarumKeyCapsMode.SHIFT)
|
else if (parent.lowlayer.capsMode == TerrarumKeyCapsMode.SHIFT)
|
||||||
batch.draw(labels.get(24,2), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(24,2), symx, symy)
|
||||||
else if (parent.lowlayer.capsMode == TerrarumKeyCapsMode.BACK)
|
else if (parent.lowlayer.capsMode == TerrarumKeyCapsMode.BACK)
|
||||||
batch.draw(labels.get(24,5), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(24,5), symx, symy)
|
||||||
}
|
}
|
||||||
else if (key == Input.Keys.ENTER)
|
else if (key == Input.Keys.ENTER)
|
||||||
batch.draw(labels.get(17,3), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(17,3), symx, symy)
|
||||||
else if (key != null) {
|
else if (key != null) {
|
||||||
val keysymsLow = parent.lowlayer.symbols[key]
|
val keysymsLow = parent.lowlayer.symbols[key]
|
||||||
val keysymLow =
|
val keysymLow =
|
||||||
(if (parent.shiftin && parent.altgrin && keysymsLow[3]?.isNotEmpty() == true) keysymsLow[3]
|
(if (parent.shiftin && parent.altgrin && keysymsLow[3]?.isNotEmpty() == true) keysymsLow[3]
|
||||||
else if (parent.altgrin && keysymsLow[2]?.isNotEmpty() == true) keysymsLow[2]
|
else if (parent.altgrin && keysymsLow[2]?.isNotEmpty() == true) keysymsLow[2]
|
||||||
else if (parent.shiftin && keysymsLow[1]?.isNotEmpty() == true) keysymsLow[1]
|
else if (parent.shiftin && keysymsLow[1]?.isNotEmpty() == true) keysymsLow[1]
|
||||||
else keysymsLow[0]) ?: ""
|
else keysymsLow[0]) ?: ""
|
||||||
|
|
||||||
val keysym0: Array<String?> = if (KeyToggler.isOn(ControlPresets.getKey("control_key_toggleime"))) {
|
val keysym0: Array<String?> = if (KeyToggler.isOn(ControlPresets.getKey("control_key_toggleime"))) {
|
||||||
if (parent.highlayer == null) arrayOf(keysymLow,keysymLow,keysymLow,keysymLow)
|
if (parent.highlayer == null) arrayOf(keysymLow,keysymLow,keysymLow,keysymLow)
|
||||||
@@ -343,17 +446,22 @@ private class UIItemInputKeycap(
|
|||||||
parent.lowlayer.symbols[key]
|
parent.lowlayer.symbols[key]
|
||||||
|
|
||||||
var keysym =
|
var keysym =
|
||||||
(if (parent.shiftin && parent.altgrin && keysym0[3]?.isNotEmpty() == true) keysym0[3]
|
(if (parent.shiftin && parent.altgrin && keysym0[3]?.isNotEmpty() == true) keysym0[3]
|
||||||
else if (parent.altgrin && keysym0[2]?.isNotEmpty() == true) keysym0[2]
|
else if (parent.altgrin && keysym0[2]?.isNotEmpty() == true) keysym0[2]
|
||||||
else if (parent.shiftin && keysym0[1]?.isNotEmpty() == true) keysym0[1]
|
else if (parent.shiftin && keysym0[1]?.isNotEmpty() == true) keysym0[1]
|
||||||
else keysym0[0]) ?: keysymLow
|
else keysym0[0]) ?: keysymLow
|
||||||
|
|
||||||
|
if (keysym.isEmpty()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (isDiacritic(keysym[0].code))
|
if (isDiacritic(keysym[0].code))
|
||||||
keysym = "\uDBBF\uDE01$keysym"
|
keysym = "\uDBBF\uDE01$keysym"
|
||||||
|
|
||||||
if (keysym[0].code == 0xA0)
|
if (keysym[0].code == 0xA0)
|
||||||
batch.draw(labels.get(22, 2), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(22, 2), symx, symy)
|
||||||
else if (keysym[0].code == 0x20)
|
else if (keysym[0].code == 0x20)
|
||||||
batch.draw(labels.get(21,2), (posX + (width - 20) / 2).toFloat(), posY + 4f)
|
batch.draw(labels.get(21,2), symx, symy)
|
||||||
else {
|
else {
|
||||||
val keysymw = App.fontGame.getWidth(keysym)
|
val keysymw = App.fontGame.getWidth(keysym)
|
||||||
App.fontGame.draw(batch, keysym, posX + (width - keysymw) / 2, posY + 2)
|
App.fontGame.draw(batch, keysym, posX + (width - keysymw) / 2, posY + 2)
|
||||||
@@ -364,4 +472,58 @@ private class UIItemInputKeycap(
|
|||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class UIItemInputKeycapTwoRowRight(
|
||||||
|
parent: UIIMEConfig,
|
||||||
|
initialX: Int,
|
||||||
|
initialY: Int,
|
||||||
|
key: Int?,
|
||||||
|
val widthUp: Int,
|
||||||
|
val widthDown: Int
|
||||||
|
) : UIItemInputKeycap(parent, initialX, initialY, key, maxOf(widthUp, widthDown), false) {
|
||||||
|
init {
|
||||||
|
this.posX = initialX + parent.kbx
|
||||||
|
this.posY = initialY + parent.kby
|
||||||
|
}
|
||||||
|
|
||||||
|
private val rowheight = 28
|
||||||
|
override val height = 60
|
||||||
|
|
||||||
|
private val heightUp = if (widthUp > widthDown) 28 else 32
|
||||||
|
private val heightDown = if (widthUp > widthDown) 32 else 28
|
||||||
|
|
||||||
|
private val posXgap = (widthUp - widthDown).abs()
|
||||||
|
|
||||||
|
override fun drawKeycap(batch: SpriteBatch) {
|
||||||
|
// key background
|
||||||
|
batch.color = keycapFill
|
||||||
|
Toolkit.fillArea(batch, posX, posY, widthUp, heightUp)
|
||||||
|
Toolkit.fillArea(batch, posX + posXgap - 1, posY + heightUp, widthDown + 1, 1)
|
||||||
|
Toolkit.fillArea(batch, posX + posXgap, posY + heightUp + 1, widthDown, heightDown - 1)
|
||||||
|
|
||||||
|
// key border
|
||||||
|
batch.color = getBorderCol()
|
||||||
|
val pack = CommonResourcePool.getAsTextureRegionPack("toolkit_box_border")
|
||||||
|
val tx = pack.tileW.toFloat()
|
||||||
|
val ty = pack.tileH.toFloat()
|
||||||
|
|
||||||
|
// top edge
|
||||||
|
batch.draw(pack.get(1, 0), posX.toFloat(), posY - ty, widthUp.toFloat(), ty)
|
||||||
|
// bottom edge L
|
||||||
|
batch.draw(pack.get(1, 2), posX.toFloat(), posY.toFloat() + heightUp, posXgap - 1f, ty)
|
||||||
|
// bottom edge R
|
||||||
|
batch.draw(pack.get(1, 2), posX.toFloat() + posXgap, posY.toFloat() + height, widthDown.toFloat(), ty)
|
||||||
|
// left edge U
|
||||||
|
batch.draw(pack.get(0, 1), posX.toFloat() - tx, posY.toFloat(), tx, heightUp.toFloat())
|
||||||
|
// left edge D
|
||||||
|
batch.draw(pack.get(0, 1), posX.toFloat() - tx + posXgap, posY + heightUp + 1f, tx, heightDown.toFloat())
|
||||||
|
// right edge
|
||||||
|
batch.draw(pack.get(2, 1), posX.toFloat() + width, posY.toFloat(), tx, height.toFloat())
|
||||||
|
|
||||||
|
if (homerow) Toolkit.drawBoxBorder(batch, posX + 9, posY + 26, 10, 1)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getKeysymPos() = (posX + posXgap + (minOf(widthUp, widthDown) - 20) / 2).toFloat() to posY + 20f
|
||||||
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class UIKeyboardControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
Input.Keys.P to UIItemKeycap(this, 337,33, Input.Keys.P, oneu, "15,4"),
|
Input.Keys.P to UIItemKeycap(this, 337,33, Input.Keys.P, oneu, "15,4"),
|
||||||
Input.Keys.LEFT_BRACKET to UIItemKeycap(this, 369,33, Input.Keys.LEFT_BRACKET, oneu, "12,3"),
|
Input.Keys.LEFT_BRACKET to UIItemKeycap(this, 369,33, Input.Keys.LEFT_BRACKET, oneu, "12,3"),
|
||||||
Input.Keys.RIGHT_BRACKET to UIItemKeycap(this, 401,33, Input.Keys.RIGHT_BRACKET, oneu, "13,3"),
|
Input.Keys.RIGHT_BRACKET to UIItemKeycap(this, 401,33, Input.Keys.RIGHT_BRACKET, oneu, "13,3"),
|
||||||
Input.Keys.BACKSLASH to UIItemKeycap(this, 433,33, Input.Keys.BACKSLASH, onehalfu, "20,3"),
|
Input.Keys.BACKSLASH to UIItemKeycap(this, 433,33, Input.Keys.BACKSLASH, onehalfu, "14,3"),
|
||||||
|
|
||||||
-5 to UIItemKeycap(this, 1,65, null, twou, "24,3"),
|
-5 to UIItemKeycap(this, 1,65, null, twou, "24,3"),
|
||||||
Input.Keys.A to UIItemKeycap(this, 57,65, Input.Keys.A, oneu, "0,4"),
|
Input.Keys.A to UIItemKeycap(this, 57,65, Input.Keys.A, oneu, "0,4"),
|
||||||
@@ -82,7 +82,8 @@ class UIKeyboardControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
Input.Keys.APOSTROPHE to UIItemKeycap(this, 377,65, Input.Keys.APOSTROPHE, oneu, "16,3"),
|
Input.Keys.APOSTROPHE to UIItemKeycap(this, 377,65, Input.Keys.APOSTROPHE, oneu, "16,3"),
|
||||||
Input.Keys.ENTER to UIItemKeycap(this, 409,65, Input.Keys.ENTER, twohalfu, "17,3"),
|
Input.Keys.ENTER to UIItemKeycap(this, 409,65, Input.Keys.ENTER, twohalfu, "17,3"),
|
||||||
|
|
||||||
Input.Keys.SHIFT_LEFT to UIItemKeycap(this, 1,97, Input.Keys.SHIFT_LEFT, twohalfu, "23,3"),
|
Input.Keys.SHIFT_LEFT to UIItemKeycap(this, 1,97, Input.Keys.SHIFT_LEFT, 36, "23,3"),
|
||||||
|
Input.Keys.WORLD_1 to UIItemKeycap(this, 41,97, Input.Keys.WORLD_1, oneu, "1,5"),
|
||||||
Input.Keys.Z to UIItemKeycap(this, 73,97, Input.Keys.Z, oneu, "0,5"),
|
Input.Keys.Z to UIItemKeycap(this, 73,97, Input.Keys.Z, oneu, "0,5"),
|
||||||
Input.Keys.X to UIItemKeycap(this, 105,97, Input.Keys.X, oneu, "23,4"),
|
Input.Keys.X to UIItemKeycap(this, 105,97, Input.Keys.X, oneu, "23,4"),
|
||||||
Input.Keys.C to UIItemKeycap(this, 137,97, Input.Keys.C, oneu, "2,4"),
|
Input.Keys.C to UIItemKeycap(this, 137,97, Input.Keys.C, oneu, "2,4"),
|
||||||
|
|||||||
@@ -198,6 +198,14 @@ abstract class UICanvas(
|
|||||||
if (!uiItems.contains(uiItem)) uiItems.add(uiItem)
|
if (!uiItems.contains(uiItem)) uiItems.add(uiItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun addUIitemAtHead(uiItem: UIItemisable) {
|
||||||
|
if (!uiItems.contains(uiItem)) uiItems.add(0, uiItem)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun removeUIitem(uiItem: UIItemisable) {
|
||||||
|
uiItems.remove(uiItem)
|
||||||
|
}
|
||||||
|
|
||||||
fun mouseInScreen(x: Int, y: Int) = x in 0 until App.scr.windowW && y in 0 until App.scr.windowH
|
fun mouseInScreen(x: Int, y: Int) = x in 0 until App.scr.windowW && y in 0 until App.scr.windowH
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user