SDL: Hook up mouse button events to bindings

This commit is contained in:
Connor McLaughlin 2020-04-26 17:24:00 +10:00
parent 3723cd5867
commit 2502afc3f6
1 changed files with 12 additions and 0 deletions

View File

@ -481,6 +481,18 @@ void SDLHostInterface::HandleSDLEvent(const SDL_Event* event)
} }
break; break;
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{
if (!ImGui::GetIO().WantCaptureMouse)
{
const s32 button = static_cast<s32>(ZeroExtend32(event->button.button));
const bool pressed = (event->type == SDL_MOUSEBUTTONDOWN);
HandleHostMouseEvent(button, pressed);
}
}
break;
case SDL_USEREVENT: case SDL_USEREVENT:
{ {
if (static_cast<u32>(event->user.code) == m_run_later_event_id) if (static_cast<u32>(event->user.code) == m_run_later_event_id)