2015-04-13 11:16:33 +00:00
|
|
|
auto InputManager::appendHotkeys() -> void {
|
2015-04-21 11:51:57 +00:00
|
|
|
{ auto hotkey = new InputHotkey;
|
2015-04-13 11:16:33 +00:00
|
|
|
hotkey->name = "Toggle Fullscreen";
|
|
|
|
hotkey->action = [] {
|
|
|
|
presentation->toggleFullScreen();
|
|
|
|
};
|
|
|
|
hotkeys.append(hotkey);
|
|
|
|
}
|
|
|
|
|
2015-05-23 05:29:18 +00:00
|
|
|
{ auto hotkey = new InputHotkey;
|
|
|
|
hotkey->name = "Toggle Mouse Capture";
|
|
|
|
hotkey->action = [] {
|
|
|
|
input.acquired() ? input.unacquire() : input.acquire();
|
|
|
|
};
|
|
|
|
hotkeys.append(hotkey);
|
|
|
|
}
|
|
|
|
|
2015-04-21 11:51:57 +00:00
|
|
|
{ auto hotkey = new InputHotkey;
|
|
|
|
hotkey->name = "Save State";
|
|
|
|
hotkey->action = [] {
|
|
|
|
program->saveState(0);
|
|
|
|
};
|
|
|
|
hotkeys.append(hotkey);
|
|
|
|
}
|
|
|
|
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
|
|
hotkey->name = "Load State";
|
|
|
|
hotkey->action = [] {
|
|
|
|
program->loadState(0);
|
|
|
|
};
|
|
|
|
hotkeys.append(hotkey);
|
|
|
|
}
|
|
|
|
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
|
|
hotkey->name = "Pause Emulation";
|
|
|
|
hotkey->action = [] {
|
|
|
|
program->pause = !program->pause;
|
|
|
|
};
|
|
|
|
hotkeys.append(hotkey);
|
|
|
|
}
|
|
|
|
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
|
|
hotkey->name = "Power Cycle";
|
|
|
|
hotkey->action = [] {
|
|
|
|
program->powerCycle();
|
|
|
|
};
|
|
|
|
hotkeys.append(hotkey);
|
|
|
|
}
|
|
|
|
|
|
|
|
{ auto hotkey = new InputHotkey;
|
|
|
|
hotkey->name = "Soft Reset";
|
|
|
|
hotkey->action = [] {
|
|
|
|
program->softReset();
|
|
|
|
};
|
|
|
|
hotkeys.append(hotkey);
|
|
|
|
}
|
|
|
|
|
2015-04-13 11:16:33 +00:00
|
|
|
Configuration::Node nodeHotkeys;
|
|
|
|
for(auto& hotkey : hotkeys) {
|
|
|
|
nodeHotkeys.append(hotkey->assignment, string{hotkey->name}.replace(" ", ""));
|
|
|
|
}
|
|
|
|
config.append(nodeHotkeys, "Hotkeys");
|
|
|
|
}
|
|
|
|
|
|
|
|
auto InputManager::pollHotkeys() -> void {
|
|
|
|
for(auto& hotkey : hotkeys) {
|
|
|
|
int16 state = hotkey->poll();
|
|
|
|
if(hotkey->state == 0 && state == 1 && hotkey->action) hotkey->action();
|
|
|
|
hotkey->state = state;
|
|
|
|
}
|
|
|
|
}
|