Reputation: 401
So I have a problem with LibGDX that I can't figure out. I have a game that I am programming in LibGDX which is running on the desktop in Windows 7. I am trying to re-position various GUI elements when a player adjusts the size of the window. My code works just fine however the resize event only fires when the window is made larger. If the total dimensions of the window is smaller after the player let's go of the edge of the window then the resize method never gets called.
I have looked at the code in LibGDX for what determines if the resize event should fire or not and I can't determine if there is anything blocking the resize event or not. None the less the resize event should fire even if the window is being made smaller. Does anyone have any tips on what I should try? Or has anyone heard of this?
EDIT: I have logged to the console from the resize method in the top level ApplicationAdapter already. I also put a break point in the resize method to get the stack trace to look at the LibGDX code which calls the resize method. But none of these things helped.
Upvotes: 1
Views: 322
Reputation: 102
Do you have a Viewport?
If yes, is it a ScreenViewport? Because that's the best viewport for your situation.
Remember to add:
viewport.update(width, height);
viewport.apply();
in
@Override
public void resize(int width, int height){}
I hope it helps! Good luck!
Upvotes: 1