For the past few days I’ve been trying to figure out how view ports work and how I can make my game fit in any resolution. Currently I’m trying to make my game 800x600 because I figured that can be scaled to almost anything without cropping. I have an extend view port that I want to have extend to fit the 800x600 game into a 1366x768 screen. With the current code I have nothing happens. I’ve tried Stretch view ports, Screen view ports and nothing. It’s always a big red square in the center of the screen (The color that the game clears with). Help?
public void show() {
cam = new OrthographicCamera();
viewport = new ExtendViewport(800, 600, cam);
viewport.apply(true);
}
@Override
public void render(float delta) {
cam.update();
}
@Override
public void resize(int width, int height) {
viewport.update(width, height);
}