1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-05 10:28:58 +00:00

Modifies mappings to improve key repeat on backspace and potentially allow mapping of other keys.

This commit is contained in:
Thomas Harte 2020-03-02 23:10:18 -05:00
parent 1f41d9c5f5
commit 32136b75cd
3 changed files with 11 additions and 5 deletions

View File

@ -13,7 +13,9 @@ using namespace AmstradCPC;
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) { uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return dest #define BIND(source, dest) case Inputs::Keyboard::Key::source: return dest
switch(key) { switch(key) {
default: return KeyCopy; default: break;
BIND(BackTick, KeyCopy);
BIND(k0, Key0); BIND(k1, Key1); BIND(k2, Key2); BIND(k3, Key3); BIND(k4, Key4); BIND(k0, Key0); BIND(k1, Key1); BIND(k2, Key2); BIND(k3, Key3); BIND(k4, Key4);
BIND(k5, Key5); BIND(k6, Key6); BIND(k7, Key7); BIND(k8, Key8); BIND(k9, Key9); BIND(k5, Key5); BIND(k6, Key6); BIND(k7, Key7); BIND(k8, Key8); BIND(k9, Key9);
@ -72,6 +74,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
BIND(KeypadDelete, KeyDelete); BIND(KeypadDelete, KeyDelete);
} }
#undef BIND #undef BIND
return KeyboardMachine::MappedMachine::KeyNotMapped;
} }
uint16_t *CharacterMapper::sequence_for_character(char character) { uint16_t *CharacterMapper::sequence_for_character(char character) {
@ -142,7 +145,7 @@ uint16_t *CharacterMapper::sequence_for_character(char character) {
/* x */ KEYS(KeyX), /* y */ KEYS(KeyY), /* x */ KEYS(KeyX), /* y */ KEYS(KeyY),
/* z */ KEYS(KeyZ), /* { */ X, /* z */ KEYS(KeyZ), /* { */ X,
/* | */ SHIFT(KeyAt), /* } */ X, /* | */ SHIFT(KeyAt), /* } */ X,
/* ~ */ X, /* DEL */ KEYS(KeyDelete), /* ~ */ X
}; };
#undef KEYS #undef KEYS
#undef SHIFT #undef SHIFT

View File

@ -13,7 +13,9 @@ using namespace Electron;
uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) { uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
#define BIND(source, dest) case Inputs::Keyboard::Key::source: return Electron::Key::dest #define BIND(source, dest) case Inputs::Keyboard::Key::source: return Electron::Key::dest
switch(key) { switch(key) {
default: return KeyCopy; default: break;
BIND(BackTick, KeyCopy);
BIND(k0, Key0); BIND(k1, Key1); BIND(k2, Key2); BIND(k3, Key3); BIND(k4, Key4); BIND(k0, Key0); BIND(k1, Key1); BIND(k2, Key2); BIND(k3, Key3); BIND(k4, Key4);
BIND(k5, Key5); BIND(k6, Key6); BIND(k7, Key7); BIND(k8, Key8); BIND(k9, Key9); BIND(k5, Key5); BIND(k6, Key6); BIND(k7, Key7); BIND(k8, Key8); BIND(k9, Key9);
@ -52,6 +54,7 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
BIND(Space, KeySpace); BIND(Space, KeySpace);
} }
#undef BIND #undef BIND
return KeyboardMachine::MappedMachine::KeyNotMapped;
} }
uint16_t *CharacterMapper::sequence_for_character(char character) { uint16_t *CharacterMapper::sequence_for_character(char character) {
@ -123,7 +126,7 @@ uint16_t *CharacterMapper::sequence_for_character(char character) {
/* x */ SHIFT(KeyX), /* y */ SHIFT(KeyY), /* x */ SHIFT(KeyX), /* y */ SHIFT(KeyY),
/* z */ SHIFT(KeyZ), /* { */ CTRL(KeyUp), /* z */ SHIFT(KeyZ), /* { */ CTRL(KeyUp),
/* | */ SHIFT(KeyRight), /* } */ CTRL(KeyDown), /* | */ SHIFT(KeyRight), /* } */ CTRL(KeyDown),
/* ~ */ CTRL(KeyLeft), /* DEL */ KEYS(KeyDelete), /* ~ */ CTRL(KeyLeft)
}; };
#undef KEYS #undef KEYS
#undef SHIFT #undef SHIFT

View File

@ -67,7 +67,7 @@
</Testables> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
buildConfiguration = "Debug" buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableASanStackUseAfterReturn = "YES" enableASanStackUseAfterReturn = "YES"