I'm using libgdx for a PC game. I am trying to make the window fullscreen while keep the original window size (1024 x 768). In other word, I want to preserve my 1024 x 768, have the game centered at the middle of the screen, and just have the black background filled in the surrounding. (I don't want my game automatically scale to the size of the host computer screen's height and width.)
I've tried with this solution. But the window is scaled and that's not exactly what I want. =( How to make LibGDX Desktop go fullscreen by default
Is it achievable in Libgdx? Thank you very much for any clue! =)
Use viewports. In your case what you need is to use ScalingViewport and initialize it with Scaling.none
parameter. I.e.:
myStaticViewport = new ScalingViewport(Scaling.none, 1024, 768);
This exact example is mentioned here.