mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-29 12:50:28 +00:00
Adds virtual keys for F2, F4, F6 and F8.
This commit is contained in:
parent
535634daca
commit
90e6bef6d7
@ -56,8 +56,6 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
||||
|
||||
BIND(Right, KeyRight);
|
||||
BIND(Down, KeyDown);
|
||||
BIND(Left, KeyLeft);
|
||||
BIND(Up, KeyUp);
|
||||
|
||||
BIND(Enter, KeyReturn);
|
||||
BIND(Space, KeySpace);
|
||||
@ -68,6 +66,14 @@ uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
|
||||
BIND(F3, KeyF3);
|
||||
BIND(F5, KeyF5);
|
||||
BIND(F7, KeyF7);
|
||||
|
||||
// Mappings to virtual keys.
|
||||
BIND(Left, KeyLeft);
|
||||
BIND(Up, KeyUp);
|
||||
BIND(F2, KeyF2);
|
||||
BIND(F4, KeyF4);
|
||||
BIND(F6, KeyF6);
|
||||
BIND(F8, KeyF8);
|
||||
}
|
||||
#undef BIND
|
||||
return KeyboardMachine::MappedMachine::KeyNotMapped;
|
||||
|
@ -37,6 +37,10 @@ enum Key: uint16_t {
|
||||
// Virtual keys.
|
||||
KeyUp = 0xfff0,
|
||||
KeyLeft = 0xfff1,
|
||||
KeyF2 = 0xfff2,
|
||||
KeyF4 = 0xfff3,
|
||||
KeyF6 = 0xfff4,
|
||||
KeyF8 = 0xfff5,
|
||||
|
||||
// Physical keys not within the usual matrix.
|
||||
KeyRestore = 0xfffd,
|
||||
|
@ -486,14 +486,19 @@ class ConcreteMachine:
|
||||
case KeyRestore:
|
||||
user_port_via_.set_control_line_input(MOS::MOS6522::Port::A, MOS::MOS6522::Line::One, !is_pressed);
|
||||
break;
|
||||
case KeyUp:
|
||||
keyboard_via_port_handler_->set_key_state(KeyLShift, is_pressed);
|
||||
keyboard_via_port_handler_->set_key_state(KeyDown, is_pressed);
|
||||
break;
|
||||
case KeyLeft:
|
||||
keyboard_via_port_handler_->set_key_state(KeyLShift, is_pressed);
|
||||
keyboard_via_port_handler_->set_key_state(KeyRight, is_pressed);
|
||||
#define ShiftedMap(source, target) \
|
||||
case source: \
|
||||
keyboard_via_port_handler_->set_key_state(KeyLShift, is_pressed); \
|
||||
keyboard_via_port_handler_->set_key_state(target, is_pressed); \
|
||||
break;
|
||||
|
||||
ShiftedMap(KeyUp, KeyDown);
|
||||
ShiftedMap(KeyLeft, KeyRight);
|
||||
ShiftedMap(KeyF2, KeyF1);
|
||||
ShiftedMap(KeyF4, KeyF3);
|
||||
ShiftedMap(KeyF6, KeyF5);
|
||||
ShiftedMap(KeyF8, KeyF7);
|
||||
#undef ShiftedMap
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user