Updated Keyboard Layout and IME (markdown)

CuriousTorvald
2022-09-18 22:40:00 +09:00
parent 4b191ca835
commit 487755947e

@@ -12,7 +12,7 @@ The layouts are stored in `<assets> or <module base dir>/keylayout/` directory a
**.key** files must be formatted as such:
```
```javascript
{
"n":"US-Intl. Qwerty", // the name of the layout
"capslock":"caps", // the capslock mode
@@ -40,29 +40,29 @@ When an IME receives a key press, it can either *accept* or *reject* the key inp
**.ime** files must be formatted as such:
```
```javascript
let states = {
"keylayouts": ..., // same format as the .key files' "t" key
"code": 0, // used internally. Write 1 if the character is being composed, 0 if not
"hasDeadKey": false, // if this keyboard layout has deadkeys
} // note: the states object is technically optional, but you *will* want to use it
return Object.freeze({
"n":"두벌식 표준", // the name of the layout
"v":"none", // candidate mode. "many" for layouts that require candidates (e.g. Chinese and Japanse), "none" if candidates are not required
"c":"CuriousTo\uA75Bvald", // the copyright string
"m":"rewrite", // the operation mode. Use one of "rewrite" or "candidates"
"t":states.keylayouts.map(it => [it[0],it[1]]), // keyboard layout. Only used by the ingame config UI to show the layout info
"l":"koKR", // the language associated with the layout
"n": "두벌식 표준", // the name of the layout
"v": "none", // candidate mode. "many" for layouts that require candidates (e.g. Chinese and Japanse), "none" if candidates are not required
"c": "CuriousTo\uA75Bvald", // the copyright string
"m": "rewrite", // the operation mode. Use one of "rewrite" or "candidates"
"t": states.keylayouts.map(it => [it[0],it[1]]), // keyboard layout. Only used by the ingame config UI to show the layout info
"l": "koKR", // the language associated with the layout
"accept": (headkey, shiftin, altgrin) => {
...
/* more codes here */
return [arg, keysymbol]
}, // a function that accepts a key input that returns an array
"backspace": () => {
...
/* more codes here */
return keysymbol
}, // a function that is called when the backspace key was down that returns a Key Symbol
"end": () => {
...
/* more codes here */
return keysymbol
}, // a function that is called when a composing is being cancelled that returns a Key Symbol
"reset": () => { ... }, // a function that resets the IME's internal state