mirror of
https://github.com/TomHarte/CLK.git
synced 2024-09-02 23:29:15 +00:00
Added a modal toggle allowing the keyboard to be switched between being a keyboard and being a joystick for the Vic.
This commit is contained in:
parent
a49f2b41cc
commit
df4724eb3e
@ -13,6 +13,7 @@
|
||||
|
||||
@implementation CSVic20 {
|
||||
Vic20::Machine _vic20;
|
||||
BOOL _joystickMode;
|
||||
}
|
||||
|
||||
- (CRTMachine::Machine * const)machine {
|
||||
@ -109,7 +110,25 @@
|
||||
// KeyPlus
|
||||
// KeyGBP
|
||||
|
||||
if(key == VK_Tab && isPressed)
|
||||
{
|
||||
_joystickMode ^= YES;
|
||||
}
|
||||
|
||||
@synchronized(self) {
|
||||
if(_joystickMode)
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
case VK_UpArrow: _vic20.set_joystick_state(Vic20::JoystickInput::Up, isPressed); break;
|
||||
case VK_DownArrow: _vic20.set_joystick_state(Vic20::JoystickInput::Down, isPressed); break;
|
||||
case VK_LeftArrow: _vic20.set_joystick_state(Vic20::JoystickInput::Left, isPressed); break;
|
||||
case VK_RightArrow: _vic20.set_joystick_state(Vic20::JoystickInput::Right, isPressed); break;
|
||||
case VK_ANSI_A: _vic20.set_joystick_state(Vic20::JoystickInput::Fire, isPressed); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(key)
|
||||
{
|
||||
default: {
|
||||
@ -129,6 +148,7 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)clearAllKeys {
|
||||
|
Loading…
Reference in New Issue
Block a user