Relayout multiplayer windows on a window size change

This commit is contained in:
Andreas Löf 2016-01-01 22:56:10 +13:00
parent afabf8c8a1
commit 52762abe45

View file

@ -313,6 +313,17 @@ void ui::handle_event(const SDL_Event& event)
{
gui::widget::handle_event(event);
#if SDL_VERSION_ATLEAST(2, 0, 0)
if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_RESIZED) {
SDL_Rect new_location;
new_location.x = 0;
new_location.y = 0;
new_location.w = event.window.data1;
new_location.h = event.window.data2;
set_location(new_location);
}
#endif
if(event.type == SDL_KEYDOWN) {
handle_key_event(event.key);
}