Frontend: Extract keyboard handling to seperate function

This commit is contained in:
Connor McLaughlin 2019-10-23 15:34:39 +10:00
parent 3db77a3139
commit 87f9f99938
2 changed files with 93 additions and 88 deletions

View File

@ -307,6 +307,17 @@ bool SDLInterface::HandleSDLEvent(const SDL_Event* event)
case SDL_KEYDOWN:
case SDL_KEYUP:
return HandleSDLKeyEvent(event);
case SDL_QUIT:
m_running = false;
break;
}
return false;
}
bool SDLInterface::HandleSDLKeyEvent(const SDL_Event* event)
{
const bool pressed = (event->type == SDL_KEYDOWN);
switch (event->key.keysym.scancode)
@ -396,13 +407,6 @@ bool SDLInterface::HandleSDLEvent(const SDL_Event* event)
default:
break;
}
}
break;
case SDL_QUIT:
m_running = false;
break;
}
return false;
}

View File

@ -70,6 +70,7 @@ private:
void DoSaveState(u32 index);
bool HandleSDLEvent(const SDL_Event* event);
bool HandleSDLKeyEvent(const SDL_Event* event);
bool PassEventToImGui(const SDL_Event* event);
void Render();
void RenderDisplay();