Easy Screen Scaling on LibGdx
@Override
public void resize(int width, int height) {
stage.setViewport(PREFFERED_WIDTH, PREFFERED_HEIGHT, true);
stage.getCamera().translate(-stage.getGutterWidth(), -stage.getGutterHeight(), 0);
if (table != null){
table.setSize(PREFFERED_WIDTH, PREFFERED_HEIGHT);
}
}
Don't forget set Table#setFillParent to false.
Written by Hendra Gunawan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Game
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#