SDL: Re-add frame step hotkey

Needs porting to Qt at some point.
This commit is contained in:
Connor McLaughlin 2020-05-17 01:00:42 +10:00
parent 1c50a09c2e
commit 93031fc27f
2 changed files with 13 additions and 0 deletions

View file

@ -351,6 +351,8 @@ bool SDLHostInterface::Initialize()
return false; return false;
} }
RegisterHotkeys();
ImGui::NewFrame(); ImGui::NewFrame();
// process events to pick up controllers before updating input map // process events to pick up controllers before updating input map
@ -1334,6 +1336,16 @@ void SDLHostInterface::ClearImGuiFocus()
ImGui::SetWindowFocus(nullptr); ImGui::SetWindowFocus(nullptr);
} }
void SDLHostInterface::RegisterHotkeys()
{
RegisterHotkey(StaticString("General"), StaticString("FrameStep"), StaticString("Frame Step"), [this](bool pressed) {
if (!pressed)
{
DoFrameStep();
}
});
}
void SDLHostInterface::DoStartDisc() void SDLHostInterface::DoStartDisc()
{ {
Assert(!m_system); Assert(!m_system);

View file

@ -72,6 +72,7 @@ private:
void DestroyDisplay(); void DestroyDisplay();
void CreateImGuiContext(); void CreateImGuiContext();
void UpdateFramebufferScale(); void UpdateFramebufferScale();
void RegisterHotkeys();
/// Executes a callback later, after the UI has finished rendering. Needed to boot while rendering ImGui. /// Executes a callback later, after the UI has finished rendering. Needed to boot while rendering ImGui.
void RunLater(std::function<void()> callback); void RunLater(std::function<void()> callback);