mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-29 12:50:28 +00:00
Adds virtual keys for F1, F2, etc.
This commit is contained in:
parent
3758ec79ac
commit
462a76dd96
@ -115,13 +115,36 @@ class ConcreteMachine:
|
||||
}
|
||||
|
||||
void set_key_state(uint16_t key, bool isPressed) final {
|
||||
if(key == KeyBreak) {
|
||||
m6502_.set_reset_line(isPressed);
|
||||
} else {
|
||||
if(isPressed)
|
||||
key_states_[key >> 4] |= key&0xf;
|
||||
else
|
||||
key_states_[key >> 4] &= ~(key&0xf);
|
||||
switch(key) {
|
||||
default:
|
||||
if(isPressed)
|
||||
key_states_[key >> 4] |= key&0xf;
|
||||
else
|
||||
key_states_[key >> 4] &= ~(key&0xf);
|
||||
break;
|
||||
|
||||
case KeyBreak:
|
||||
m6502_.set_reset_line(isPressed);
|
||||
break;
|
||||
|
||||
#define ShiftedKey(source, dest) \
|
||||
case source: \
|
||||
set_key_state(KeyShift, isPressed); \
|
||||
set_key_state(dest, isPressed); \
|
||||
break;
|
||||
|
||||
ShiftedKey(KeyF1, Key1);
|
||||
ShiftedKey(KeyF2, Key2);
|
||||
ShiftedKey(KeyF3, Key3);
|
||||
ShiftedKey(KeyF4, Key4);
|
||||
ShiftedKey(KeyF5, Key5);
|
||||
ShiftedKey(KeyF6, Key6);
|
||||
ShiftedKey(KeyF7, Key7);
|
||||
ShiftedKey(KeyF8, Key8);
|
||||
ShiftedKey(KeyF9, Key9);
|
||||
ShiftedKey(KeyF0, Key0);
|
||||
|
||||
#undef ShiftedKey
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -52,6 +52,18 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
||||
BIND(KeypadMinus, KeyMinus); BIND(KeypadPlus, KeyColon);
|
||||
|
||||
BIND(Space, KeySpace);
|
||||
|
||||
// Virtual mappings.
|
||||
BIND(F1, KeyF1);
|
||||
BIND(F2, KeyF2);
|
||||
BIND(F3, KeyF3);
|
||||
BIND(F4, KeyF4);
|
||||
BIND(F5, KeyF5);
|
||||
BIND(F6, KeyF6);
|
||||
BIND(F7, KeyF7);
|
||||
BIND(F8, KeyF8);
|
||||
BIND(F9, KeyF9);
|
||||
BIND(F10, KeyF0);
|
||||
}
|
||||
#undef BIND
|
||||
return KeyboardMachine::MappedMachine::KeyNotMapped;
|
||||
|
@ -30,6 +30,9 @@ enum Key: uint16_t {
|
||||
KeyZ = 0x00c0 | 0x08, KeyA = 0x00c0 | 0x04, KeyQ = 0x00c0 | 0x02, Key1 = 0x00c0 | 0x01,
|
||||
KeyShift = 0x00d0 | 0x08, KeyControl = 0x00d0 | 0x04, KeyFunc = 0x00d0 | 0x02, KeyEscape = 0x00d0 | 0x01,
|
||||
|
||||
// Virtual keys.
|
||||
KeyF1 = 0xfff0, KeyF2, KeyF3, KeyF4, KeyF5, KeyF6, KeyF7, KeyF8, KeyF9, KeyF0,
|
||||
|
||||
KeyBreak = 0xfffd,
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user