Libgdx Orthographic Camera

I’ve have some problems with this, and hopefully you guys can help me with it :slight_smile:

I have a 800 x 600 area where the game would be. And I also have a 800 x 600 window. But the window would be resizable, and I don’t want to stretch or have any black bars on the sides of the game. I just want it to still be 800 x 600, and bottom centered. (I’ve made sure that the windows can’t be less than 800 x 600)

Something like this

I’ve fiddled around with the stage, camera and the resize function but nothing seems to be working :frowning:

In the [icode]resize(int width, int height)[/icode] method in your main class, go like this:


camera.viewportWidth = width;
camera.viewportHeight = height;
camera.update();

Welp. Didn’t knew it was that simple. Using this while setting the camera’s y position to keep it at the bottom did the trick for me.

Thanks so much!