Support for SDL2's mouse wheel event in the GUI1 scrollbar.

This commit is contained in:
Boldizsár Lipka 2014-03-14 22:48:44 +01:00
parent 85e8c45273
commit 5e96c47d2e

View File

@ -375,6 +375,21 @@ void scrollbar::handle_event(const SDL_Event& event)
}
break;
}
#if SDL_VERSION_ATLEAST(2,0,0)
case SDL_MOUSEWHEEL:
{
const SDL_MouseWheelEvent& e = event.wheel;
int x, y;
SDL_GetMouseState(&x, &y);
bool on_groove = point_in_rect(x, y, groove);
if (on_groove && e.y < 0) {
move_position(scroll_rate_);
} else if (on_groove && e.y > 0) {
move_position(-scroll_rate_);
}
break;
}
#endif
default:
break;
}