Merge pull request #1383 from Azaezel/MangledMouse

sdl2 mouse wheel scrolling
This commit is contained in:
Areloch 2015-07-30 09:24:38 -05:00
commit 2695a2aeae
3 changed files with 20 additions and 1 deletions

View file

@ -432,6 +432,11 @@ void PlatformWindowSDL::_triggerMouseLocationNotify(const SDL_Event& evt)
mouseEvent.trigger(getWindowId(), 0, evt.motion.xrel, evt.motion.yrel, true);
}
void PlatformWindowSDL::_triggerMouseWheelNotify(const SDL_Event& evt)
{
wheelEvent.trigger(getWindowId(), 0, evt.wheel.x, evt.wheel.y);
}
void PlatformWindowSDL::_triggerMouseButtonNotify(const SDL_Event& event)
{
S32 action = (event.type == SDL_MOUSEBUTTONDOWN) ? SI_MAKE : SI_BREAK;
@ -530,12 +535,17 @@ void PlatformWindowSDL::_processSDLEvent(SDL_Event &evt)
break;
}
case SDL_MOUSEWHEEL:
{
_triggerMouseWheelNotify(evt);
break;
}
case SDL_MOUSEMOTION:
{
_triggerMouseLocationNotify(evt);
break;
}
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
{

View file

@ -92,6 +92,7 @@ private:
void _processSDLEvent(SDL_Event &evt);
void _triggerMouseLocationNotify(const SDL_Event& evt);
void _triggerMouseButtonNotify(const SDL_Event& event);
void _triggerMouseWheelNotify(const SDL_Event& event);
void _triggerKeyNotify(const SDL_Event& event);
void _triggerTextNotify(const SDL_Event& event);

View file

@ -214,6 +214,14 @@ void PlatformWindowManagerSDL::_process()
break;
}
case SDL_MOUSEWHEEL:
{
PlatformWindowSDL *window = mWindowMap[evt.wheel.windowID];
if (window)
window->_processSDLEvent(evt);
break;
}
case SDL_MOUSEMOTION:
{
PlatformWindowSDL *window = mWindowMap[evt.motion.windowID];