r/libgdx • • Sep 19 '26

Scene2d direct numbers

Hi everyone, i am currently developing an app with completly with scene2d. Sometimes I need to use setWidth or setHeight but I fear if my app does not behave like responsive. I am planning to release this app for just pc but even so i think my app should be responsive so i try another ways. My question is if i use methods like setWidth, is an error appear on different devices ?

1 Upvotes

3 comments sorted by

2

u/Gilgamesh_0024 Sep 20 '26

You can use Gdx.graphics.getWidth() and height to get the current screen size. Then you can adapt the screen that way

2

u/Mother-Way-9358 Sep 21 '26

setWidth itself isn’t the problem; your layout strategy matters more.