mkptdq
Last Updated: February 25, 2016
·
2.545K
· drabiter
Dsc 0105 0

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.

Say Thanks
Respond