first step of keyboard rebinding

pull/685/head
Greenlamp 2024-05-12 16:10:25 +02:00
parent 09ea1db8fa
commit 2bc5a7665e
10 changed files with 1109 additions and 4 deletions

View File

@ -0,0 +1,644 @@
{"frames": [
{
"filename": "T_0_Key_Dark.png",
"frame": {"x":0,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_1_Key_Dark.png",
"frame": {"x":128,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_2_Key_Dark.png",
"frame": {"x":256,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_3_Key_Dark-1.png",
"frame": {"x":384,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_3_Key_Dark.png",
"frame": {"x":512,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_5_Key_Dark.png",
"frame": {"x":640,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_6_Key_Dark.png",
"frame": {"x":768,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_7_Key_Dark.png",
"frame": {"x":896,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_8_Key_Dark.png",
"frame": {"x":1024,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_9_Key_Dark.png",
"frame": {"x":1152,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_A_Key_Dark.png",
"frame": {"x":1280,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Alt_Key_Dark.png",
"frame": {"x":1408,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Asterisk_Key_Dark.png",
"frame": {"x":1536,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_B_Key_Dark.png",
"frame": {"x":1664,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Backspace_Alt_Key_Dark.png",
"frame": {"x":1792,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_BackSpace_Key_Dark.png",
"frame": {"x":1920,"y":0,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Brackets_L_Key_Dark.png",
"frame": {"x":0,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Brackets_R_Key_Dark.png",
"frame": {"x":128,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_C_Key_Dark.png",
"frame": {"x":256,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Crtl_Key_Dark.png",
"frame": {"x":384,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_D_Key_Dark.png",
"frame": {"x":512,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Del_Key_Dark.png",
"frame": {"x":640,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Down_Key_Dark.png",
"frame": {"x":768,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_E_Key_Dark.png",
"frame": {"x":896,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_End_Key_Dark.png",
"frame": {"x":1024,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Enter_Alt_Key_Dark.png",
"frame": {"x":1152,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Esc_Key_Dark.png",
"frame": {"x":1280,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F1_Key_Dark.png",
"frame": {"x":1408,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F2_Key_Dark.png",
"frame": {"x":1536,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F3_Key_Dark.png",
"frame": {"x":1664,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F4_Key_Dark.png",
"frame": {"x":1792,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F5_Key_Dark.png",
"frame": {"x":1920,"y":128,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F6_Key_Dark.png",
"frame": {"x":0,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F7_Key_Dark.png",
"frame": {"x":128,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F8_Key_Dark.png",
"frame": {"x":256,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F9_Key_Dark.png",
"frame": {"x":384,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F10_Key_Dark.png",
"frame": {"x":512,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F11_Key_Dark.png",
"frame": {"x":640,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F12_Key_Dark.png",
"frame": {"x":768,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_F_Key_Dark.png",
"frame": {"x":896,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_G_Key_Dark.png",
"frame": {"x":1024,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_H_Key_Dark.png",
"frame": {"x":1152,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Home_Key_Dark.png",
"frame": {"x":1280,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_I_Key_Dark.png",
"frame": {"x":1408,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Ins_Key_Dark.png",
"frame": {"x":1536,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_J_Key_Dark.png",
"frame": {"x":1664,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_K_Key_Dark.png",
"frame": {"x":1792,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Keyboard_R_Key_Dark-1.png",
"frame": {"x":1920,"y":256,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Keyboard_R_Key_Dark.png",
"frame": {"x":0,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_L_Key_Dark.png",
"frame": {"x":128,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Left_Key_Dark.png",
"frame": {"x":256,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_M_Key_Dark.png",
"frame": {"x":384,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Minus_Key_Dark.png",
"frame": {"x":512,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_N_Key_Dark.png",
"frame": {"x":640,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_O_Key_Dark.png",
"frame": {"x":768,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_P_Key_Dark.png",
"frame": {"x":896,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_PageDown_Key_Dark.png",
"frame": {"x":1024,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_PageUp_Key_Dark.png",
"frame": {"x":1152,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Plus_Tall_Key_Dark.png",
"frame": {"x":1280,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Q_Key_Dark.png",
"frame": {"x":1408,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Quotation_Key_Dark.png",
"frame": {"x":1536,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_R_Key_Dark.png",
"frame": {"x":1664,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Right_Key_Dark.png",
"frame": {"x":1792,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_S_Key_Dark.png",
"frame": {"x":1920,"y":384,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Semicolon_Key_Dark.png",
"frame": {"x":0,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Shift_Key_Dark.png",
"frame": {"x":128,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Shift_Super_Wide_Key_Dark.png",
"frame": {"x":256,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Slash_Key_Dark.png",
"frame": {"x":384,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Space_Key_Dark.png",
"frame": {"x":512,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_T_Key_Dark.png",
"frame": {"x":640,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Tab_Key_Dark.png",
"frame": {"x":768,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Tilde_Key_Dark.png",
"frame": {"x":896,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_U_Key_Dark.png",
"frame": {"x":1024,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Up_Key_Dark.png",
"frame": {"x":1152,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_V_Key_Dark.png",
"frame": {"x":1280,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_W_Key_Dark.png",
"frame": {"x":1408,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_X_Key_Dark.png",
"frame": {"x":1536,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Y_Key_Dark.png",
"frame": {"x":1664,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
},
{
"filename": "T_Z_Key_Dark.png",
"frame": {"x":1792,"y":512,"w":128,"h":128},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":128},
"sourceSize": {"w":128,"h":128}
}],
"meta": {
"app": "https://www.codeandweb.com/texturepacker",
"version": "1.0",
"image": "keyboard.png",
"format": "RGBA8888",
"size": {"w":2048,"h":640},
"scale": "1",
"smartupdate": "$TexturePacker:SmartUpdate:c63c48370eadc7845a8cc15895f925a0:5ddaf57801c3bd84e190cd9b4786d52d:bad03abb89ad027d879c383c13fd51bc$"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

176
src/configs/keyboard.ts Normal file
View File

@ -0,0 +1,176 @@
import {SettingGamepad} from "../system/settings-gamepad";
import {Button} from "../enums/buttons";
/**
* 081f-e401 - UnlicensedSNES
*/
const pad_unlicensedSNES = {
padID: 'keyboard',
padType: 'keyboard',
gamepadMapping: {
KEY_A: 0,
KEY_B: 0,
KEY_C: 0,
KEY_D: 0,
KEY_E: 0,
KEY_F: 0,
KEY_G: 0,
KEY_H: 0,
KEY_I: 0,
KEY_J: 0,
KEY_K: 0,
KEY_L: 0,
KEY_M: 0,
KEY_N: 0,
KEY_O: 0,
KEY_P: 0,
KEY_Q: 0,
KEY_R: 0,
KEY_S: 0,
KEY_T: 0,
KEY_U: 0,
KEY_V: 0,
KEY_W: 0,
KEY_X: 0,
KEY_Y: 0,
KEY_Z: 0,
KEY_0: 0,
KEY_1: 0,
KEY_2: 0,
KEY_3: 0,
KEY_4: 0,
KEY_5: 0,
KEY_6: 0,
KEY_7: 0,
KEY_8: 0,
KEY_9: 0,
KEY_CTRL: 0,
KEY_DEL: 0,
KEY_END: 0,
KEY_ENTER: 0,
KEY_ESC: 0,
KEY_F1: 0,
KEY_F2: 0,
KEY_F3: 0,
KEY_F4: 0,
KEY_F5: 0,
KEY_F6: 0,
KEY_F7: 0,
KEY_F8: 0,
KEY_F9: 0,
KEY_F10: 0,
KEY_F11: 0,
KEY_F12: 0,
KEY_HOME: 0,
KEY_INSERT: 0,
KEY_PAGE_DOWN: 0,
KEY_PAGE_UP: 0,
KEY_PLUS: 0,
KEY_MINUS: 0,
KEY_QUOTATION: 0,
KEY_SHIFT: 0,
KEY_LEFT_SHIFT: 0,
KEY_SPACE: 0,
KEY_TAB: 0,
KEY_TILDE: 0,
KEY_ARROW_UP: 0,
KEY_ARROW_DOWN: 0,
KEY_ARROW_LEFT: 0,
KEY_ARROW_RIGHT: 0,
KEY_LEFT_BRACKET: 0,
KEY_RIGHT_BRACKET: 0,
KEY_SEMICOLON: 0,
KEY_ASTERISK: 0
},
icons: {
KEY_A: "T_A_Key_Dark.png",
KEY_B: "T_B_Key_Dark.png",
KEY_C: "T_C_Key_Dark.png",
KEY_D: "T_D_Key_Dark.png",
KEY_E: "T_E_Key_Dark.png",
KEY_F: "T_F_Key_Dark.png",
KEY_G: "T_G_Key_Dark.png",
KEY_H: "T_H_Key_Dark.png",
KEY_I: "T_I_Key_Dark.png",
KEY_J: "T_J_Key_Dark.png",
KEY_K: "T_K_Key_Dark.png",
KEY_L: "T_L_Key_Dark.png",
KEY_M: "T_M_Key_Dark.png",
KEY_N: "T_N_Key_Dark.png",
KEY_O: "T_O_Key_Dark.png",
KEY_P: "T_P_Key_Dark.png",
KEY_Q: "T_Q_Key_Dark.png",
KEY_R: "T_R_Key_Dark.png",
KEY_S: "T_S_Key_Dark.png",
KEY_T: "T_T_Key_Dark.png",
KEY_U: "T_U_Key_Dark.png",
KEY_V: "T_V_Key_Dark.png",
KEY_W: "T_W_Key_Dark.png",
KEY_X: "T_X_Key_Dark.png",
KEY_Y: "T_Y_Key_Dark.png",
KEY_Z: "T_Z_Key_Dark.png",
KEY_0: "T_0_Key_Dark.png",
KEY_1: "T_1_Key_Dark.png",
KEY_2: "T_2_Key_Dark.png",
KEY_3: "T_3_Key_Dark.png",
KEY_4: "T_4_Key_Dark.png",
KEY_5: "T_5_Key_Dark.png",
KEY_6: "T_6_Key_Dark.png",
KEY_7: "T_7_Key_Dark.png",
KEY_8: "T_8_Key_Dark.png",
KEY_9: "T_9_Key_Dark.png",
KEY_F1: "T_F1_Key_Dark.png",
KEY_F2: "T_F2_Key_Dark.png",
KEY_F3: "T_F3_Key_Dark.png",
KEY_F4: "T_F4_Key_Dark.png",
KEY_F5: "T_F5_Key_Dark.png",
KEY_F6: "T_F6_Key_Dark.png",
KEY_F7: "T_F7_Key_Dark.png",
KEY_F8: "T_F8_Key_Dark.png",
KEY_F9: "T_F9_Key_Dark.png",
KEY_F10: "T_F10_Key_Dark.png",
KEY_F11: "T_F11_Key_Dark.png",
KEY_F12: "T_F12_Key_Dark.png",
KEY_PAGE_DOWN: "T_PageDown_Key_Dark.png",
KEY_PAGE_UP: "T_PageUp_Key_Dark.png",
KEY_CTRL: "T_CTRL_Key_Dark.png",
KEY_DEL: "T_DEL_Key_Dark.png",
KEY_END: "T_END_Key_Dark.png",
KEY_ENTER: "T_ENTER_Key_Dark.png",
KEY_ESC: "T_ESC_Key_Dark.png",
KEY_HOME: "T_HOME_Key_Dark.png",
KEY_INSERT: "T_INSERT_Key_Dark.png",
KEY_PLUS: "T_PLUS_Key_Dark.png",
KEY_MINUS: "T_MINUS_Key_Dark.png",
KEY_QUOTATION: "T_QUOTATION_Key_Dark.png",
KEY_SHIFT: "T_SHIFT_Key_Dark.png",
KEY_LEFT_SHIFT: "T_Shift_Super_Wide_Key_Dark.png",
KEY_SPACE: "T_SPACE_Key_Dark.png",
KEY_TAB: "T_TAB_Key_Dark.png",
KEY_TILDE: "T_TILDE_Key_Dark.png",
KEY_ARROW_UP: "T_Up_Key_Dark.png",
KEY_ARROW_DOWN: "T_Down_Key_Dark.png",
KEY_ARROW_LEFT: "T_Left_Key_Dark.png",
KEY_ARROW_RIGHT: "T_Right_Key_Dark.png",
KEY_LEFT_BRACKET: "T_Brackets_L_Key_Dark.png",
KEY_RIGHT_BRACKET: "T_Brackets_R_Key_Dark.png",
KEY_SEMICOLON: "T_Semicolon_Key_Dark.png",
KEY_ASTERISK: "T_Asterisk_Key_Dark.png"
},
setting: {
},
default: {
}
};
export default pad_unlicensedSNES;

View File

@ -217,6 +217,7 @@ export class LoadingScene extends SceneBase {
this.loadAtlas('nswitch', 'inputs');
this.loadAtlas('xbox', 'inputs');
this.loadAtlas('snes', 'inputs');
this.loadAtlas('keyboard', 'inputs');
this.loadSe('select');
this.loadSe('menu_open');

View File

@ -0,0 +1,87 @@
import {SettingDefaults, SettingOptions} from "#app/system/settings";
import {Button} from "#app/enums/buttons";
import BattleScene from "#app/battle-scene";
import {SettingGamepad} from "#app/system/settings-gamepad";
import {Mode} from "#app/ui/ui";
export enum SettingKeyboard {
Button_Action = "BUTTON_ACTION",
Button_Cancel = "BUTTON_CANCEL",
Button_Menu = "BUTTON_MENU",
Button_Stats = "BUTTON_STATS",
Button_Cycle_Form = "BUTTON_CYCLE_FORM",
Button_Cycle_Shiny = "BUTTON_CYCLE_SHINY",
Button_Cycle_Gender = "BUTTON_CYCLE_GENDER",
Button_Cycle_Ability = "BUTTON_CYCLE_ABILITY",
Button_Cycle_Nature = "BUTTON_CYCLE_NATURE",
Button_Cycle_Variant = "BUTTON_CYCLE_VARIANT",
Button_Speed_Up = "BUTTON_SPEED_UP",
Button_Slow_Down = "BUTTON_SLOW_DOWN",
Button_Submit = "BUTTON_SUBMIT",
}
export const settingKeyboardOptions: SettingOptions = {
[SettingKeyboard.Button_Action]: [`KEY ${Button.ACTION.toString()}`, 'Change'],
[SettingKeyboard.Button_Cancel]: [`KEY ${Button.CANCEL.toString()}`, 'Change'],
[SettingKeyboard.Button_Menu]: [`KEY ${Button.MENU.toString()}`, 'Change'],
[SettingKeyboard.Button_Stats]: [`KEY ${Button.STATS.toString()}`, 'Change'],
[SettingKeyboard.Button_Cycle_Form]: [`KEY ${Button.CYCLE_FORM.toString()}`, 'Change'],
[SettingKeyboard.Button_Cycle_Shiny]: [`KEY ${Button.CYCLE_SHINY.toString()}`, 'Change'],
[SettingKeyboard.Button_Cycle_Gender]: [`KEY ${Button.CYCLE_GENDER.toString()}`, 'Change'],
[SettingKeyboard.Button_Cycle_Ability]: [`KEY ${Button.CYCLE_ABILITY.toString()}`, 'Change'],
[SettingKeyboard.Button_Cycle_Nature]: [`KEY ${Button.CYCLE_NATURE.toString()}`, 'Change'],
[SettingKeyboard.Button_Cycle_Variant]: [`KEY ${Button.CYCLE_VARIANT.toString()}`, 'Change'],
[SettingKeyboard.Button_Speed_Up]: [`KEY ${Button.SPEED_UP.toString()}`, 'Change'],
[SettingKeyboard.Button_Slow_Down]: [`KEY ${Button.SLOW_DOWN.toString()}`, 'Change'],
[SettingKeyboard.Button_Submit]: [`KEY ${Button.SUBMIT.toString()}`, 'Change']
};
export const settingKeyboardDefaults: SettingDefaults = {
[SettingKeyboard.Button_Action]: 0,
[SettingKeyboard.Button_Cancel]: 0,
[SettingKeyboard.Button_Menu]: 0,
[SettingKeyboard.Button_Stats]: 0,
[SettingKeyboard.Button_Cycle_Form]: 0,
[SettingKeyboard.Button_Cycle_Shiny]: 0,
[SettingKeyboard.Button_Cycle_Gender]: 0,
[SettingKeyboard.Button_Cycle_Ability]: 0,
[SettingKeyboard.Button_Cycle_Nature]: 0,
[SettingKeyboard.Button_Cycle_Variant]: 0,
[SettingKeyboard.Button_Speed_Up]: 0,
[SettingKeyboard.Button_Slow_Down]: 0,
[SettingKeyboard.Button_Submit]: 0,
};
export function setSettingKeyboard(scene: BattleScene, setting: SettingKeyboard, value: integer): boolean {
switch (setting) {
case SettingKeyboard.Button_Action:
case SettingKeyboard.Button_Cancel:
case SettingKeyboard.Button_Menu:
case SettingKeyboard.Button_Stats:
case SettingKeyboard.Button_Cycle_Shiny:
case SettingKeyboard.Button_Cycle_Form:
case SettingKeyboard.Button_Cycle_Gender:
case SettingKeyboard.Button_Cycle_Ability:
case SettingKeyboard.Button_Cycle_Nature:
case SettingKeyboard.Button_Cycle_Variant:
case SettingKeyboard.Button_Speed_Up:
case SettingKeyboard.Button_Slow_Down:
if (value) {
if (scene.ui) {
const cancelHandler = (success: boolean = false) : boolean => {
scene.ui.revertMode();
(scene.ui.getHandler() as SettingsKeyboardUiHandler).updateBindings();
return success;
}
scene.ui.setOverlayMode(Mode.KEYBOARD_BINDING, {
target: setting,
cancelHandler: cancelHandler,
})
}
}
break;
}
return true;
}

View File

@ -0,0 +1,89 @@
import UiHandler from "#app/ui/ui-handler";
import BattleScene from "#app/battle-scene";
import {Mode} from "#app/ui/ui";
import {Button} from "#app/enums/buttons";
export default class KeyboardBindingUiHandler extends UiHandler {
constructor(scene: BattleScene, mode?: Mode) {
super(scene, mode);
}
setup() {
const ui = this.getUi();
}
updateBindings(): void {
}
show(args: any[]): boolean {
super.show(args);
// Move the settings container to the end of the UI stack to ensure it is displayed on top.
// this.getUi().moveTo(this.settingsContainer, this.getUi().length - 1);
// Hide any tooltips that might be visible before showing the settings container.
this.getUi().hideTooltip();
// Return true to indicate the UI was successfully shown.
return true;
}
processInput(button: Button): boolean {
const ui = this.getUi();
return false;
}
setCursor(cursor: integer): boolean {
const ret = super.setCursor(cursor);
return ret;
}
setOptionCursor(settingIndex: integer, cursor: integer, save?: boolean): boolean {
return true;
}
setScrollCursor(scrollCursor: integer): boolean {
return true;
}
// updateSettingsScroll(): void {
// // Return immediately if the options container is not initialized.
// if (!this.optionsContainer) return;
//
// // Set the vertical position of the options container based on the current scroll cursor, multiplying by the item height.
// this.optionsContainer.setY(-16 * this.scrollCursor);
//
// // Iterate over all setting labels to update their visibility.
// for (let s = 0; s < this.settingLabels.length; s++) {
// // Determine if the current setting should be visible based on the scroll position.
// const visible = s >= this.scrollCursor && s < this.scrollCursor + 9;
//
// // Set the visibility of the setting label and its corresponding options.
// this.settingLabels[s].setVisible(visible);
// for (let option of this.optionValueLabels[s])
// option.setVisible(visible);
// }
// }
clear(): void {
super.clear();
// Hide the settings container to remove it from the view.
// this.settingsContainer.setVisible(false);
// Remove the cursor from the UI.
this.eraseCursor();
}
eraseCursor(): void {
// Check if a cursor object exists.
// if (this.cursorObj)
// this.cursorObj.destroy(); // Destroy the cursor object to clean up resources.
//
// // Set the cursor object reference to null to fully dereference it.
// this.cursorObj = null;
}
}

View File

@ -78,12 +78,17 @@ export default class SettingsGamepadUiHandler extends UiHandler {
gamepadText.setOrigin(0, 0);
gamepadText.setPositionRelative(headerBg, 50, 4);
const keyboardText = addTextObject(this.scene, 0, 0, 'Keyboard', TextStyle.SETTINGS_LABEL);
keyboardText.setOrigin(0, 0);
keyboardText.setPositionRelative(headerBg, 97, 4);
this.optionsBg = addWindow(this.scene, 0, headerBg.height, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - headerBg.height - 2);
this.optionsBg.setOrigin(0, 0);
this.settingsContainer.add(headerBg);
this.settingsContainer.add(headerText);
this.settingsContainer.add(gamepadText);
this.settingsContainer.add(keyboardText);
this.settingsContainer.add(this.optionsBg);
/// Initialize a new configuration "screen" for each type of gamepad.
@ -367,10 +372,13 @@ export default class SettingsGamepadUiHandler extends UiHandler {
success = this.setOptionCursor(cursor, this.optionCursors[cursor] + 1, true);
break;
case Button.CYCLE_FORM: // Change the UI mode to SETTINGS mode.
case Button.CYCLE_SHINY:
this.scene.ui.setMode(Mode.SETTINGS)
success = true;
break;
case Button.CYCLE_SHINY:
this.scene.ui.setMode(Mode.SETTINGS_KEYBOARD)
success = true;
break;
}
}

View File

@ -0,0 +1,89 @@
import UiHandler from "#app/ui/ui-handler";
import BattleScene from "#app/battle-scene";
import {Mode} from "#app/ui/ui";
import {Button} from "#app/enums/buttons";
export default class SettingsKeyboardUiHandler extends UiHandler {
constructor(scene: BattleScene, mode?: Mode) {
super(scene, mode);
}
setup() {
const ui = this.getUi();
}
updateBindings(): void {
}
show(args: any[]): boolean {
super.show(args);
// Move the settings container to the end of the UI stack to ensure it is displayed on top.
// this.getUi().moveTo(this.settingsContainer, this.getUi().length - 1);
// Hide any tooltips that might be visible before showing the settings container.
this.getUi().hideTooltip();
// Return true to indicate the UI was successfully shown.
return true;
}
processInput(button: Button): boolean {
const ui = this.getUi();
return false;
}
setCursor(cursor: integer): boolean {
const ret = super.setCursor(cursor);
return ret;
}
setOptionCursor(settingIndex: integer, cursor: integer, save?: boolean): boolean {
return true;
}
setScrollCursor(scrollCursor: integer): boolean {
return true;
}
// updateSettingsScroll(): void {
// // Return immediately if the options container is not initialized.
// if (!this.optionsContainer) return;
//
// // Set the vertical position of the options container based on the current scroll cursor, multiplying by the item height.
// this.optionsContainer.setY(-16 * this.scrollCursor);
//
// // Iterate over all setting labels to update their visibility.
// for (let s = 0; s < this.settingLabels.length; s++) {
// // Determine if the current setting should be visible based on the scroll position.
// const visible = s >= this.scrollCursor && s < this.scrollCursor + 9;
//
// // Set the visibility of the setting label and its corresponding options.
// this.settingLabels[s].setVisible(visible);
// for (let option of this.optionValueLabels[s])
// option.setVisible(visible);
// }
// }
clear(): void {
super.clear();
// Hide the settings container to remove it from the view.
// this.settingsContainer.setVisible(false);
// Remove the cursor from the UI.
this.eraseCursor();
}
eraseCursor(): void {
// Check if a cursor object exists.
// if (this.cursorObj)
// this.cursorObj.destroy(); // Destroy the cursor object to clean up resources.
//
// // Set the cursor object reference to null to fully dereference it.
// this.cursorObj = null;
}
}

View File

@ -50,6 +50,10 @@ export default class SettingsUiHandler extends UiHandler {
gamepadText.setOrigin(0, 0);
gamepadText.setPositionRelative(headerBg, 50, 4);
const keyboardText = addTextObject(this.scene, 0, 0, 'Keyboard', TextStyle.SETTINGS_LABEL);
keyboardText.setOrigin(0, 0);
keyboardText.setPositionRelative(headerBg, 97, 4);
this.optionsBg = addWindow(this.scene, 0, headerBg.height, (this.scene.game.canvas.width / 6) - 2, (this.scene.game.canvas.height / 6) - headerBg.height - 2);
this.optionsBg.setOrigin(0, 0);
@ -97,6 +101,7 @@ export default class SettingsUiHandler extends UiHandler {
this.settingsContainer.add(headerBg);
this.settingsContainer.add(headerText);
this.settingsContainer.add(gamepadText);
this.settingsContainer.add(keyboardText);
this.settingsContainer.add(this.optionsBg);
this.settingsContainer.add(this.optionsContainer);
@ -187,11 +192,11 @@ export default class SettingsUiHandler extends UiHandler {
if (this.optionCursors[cursor] < this.optionValueLabels[cursor].length - 1)
success = this.setOptionCursor(cursor, this.optionCursors[cursor] + 1, true);
break;
case Button.CYCLE_FORM:
this.scene.ui.setMode(Mode.SETTINGS_GAMEPAD)
case Button.CYCLE_FORM: // to the left
this.scene.ui.setMode(Mode.SETTINGS_KEYBOARD)
success = true;
break;
case Button.CYCLE_SHINY:
case Button.CYCLE_SHINY: // to the right
this.scene.ui.setMode(Mode.SETTINGS_GAMEPAD)
success = true;
break;

View File

@ -38,6 +38,8 @@ import OutdatedModalUiHandler from './outdated-modal-ui-handler';
import SessionReloadModalUiHandler from './session-reload-modal-ui-handler';
import {Button} from "../enums/buttons";
import GamepadBindingUiHandler from "./gamepad-binding-ui-handler";
import SettingsKeyboardUiHandler from "#app/ui/settings-keyboard-ui-handler";
import KeyboardBindingUiHandler from "#app/ui/keyboard-binding-ui-handler";
export enum Mode {
MESSAGE,
@ -60,6 +62,8 @@ export enum Mode {
SETTINGS,
SETTINGS_GAMEPAD,
GAMEPAD_BINDING,
SETTINGS_KEYBOARD,
KEYBOARD_BINDING,
ACHIEVEMENTS,
GAME_STATS,
VOUCHERS,
@ -145,6 +149,8 @@ export default class UI extends Phaser.GameObjects.Container {
new SettingsUiHandler(scene),
new SettingsGamepadUiHandler(scene),
new GamepadBindingUiHandler(scene),
new SettingsKeyboardUiHandler(scene),
new KeyboardBindingUiHandler(scene),
new AchvsUiHandler(scene),
new GameStatsUiHandler(scene),
new VouchersUiHandler(scene),