[LibGDX] Button image strecth issues

hello , i have been using Button with ButtonStyle to draw images on the buttons
the problem is my game screen has a value of (480x800)
so when i play on larger screen resolutions every thing gets stretched/scaled automatically except for the buttons … they remain the same(small).
i think maybe because of the gdx-texturepacker i used to back the ButtonStyle … or maybe it’s some thing else so please can any one help me ?

You could just restrict the viewport size.

Don’t use:

OrthographicCamera cam = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

This will cause the camera to stretch to the screen size, if you just define a fixed width/height:

OrthographicCamera cam = new OrthographicCamera(480, 800);

You can then pass this to your Stage.

Probably better to use the new Viewport API:

stage.setViewport(new FitViewport(480, 800));

thank you Gibbo3771 , but the camera was already on a fixed size

yep that’s it !
although i have done so in show() method , but i have to repeat this code in resize() methods .

thank you guys.

That is very new, LibGDX 1.0 yeah?

Not used Scene2D since update, gonna have a gander.

Gibbo3771, aye, there is a blog post about it.

Ahamd Zuman, in resize() you can use:

stage.getViewport().update(width, height);

Use update(w, h, true) if you want the camera centered.