how to correctly change screen size

Asked by At

I am a novice of libGDX and I want to make a simple graphical interface I soon found myself in difficulty due to the lack of a graphic editor. In the end I found Overlap2D on Google, which I was able to include it in my project and to run it. However, I have two questions about this framework:

1) Is it abandoned? Is it advisable to use it or will it be abandoned soon?

2) I created a simple screen with four images:

If I increase the size of the screen, what happens is that the drops do not position themselves according to the four previous corners but remain where they are.

I'll post the code I wrote. How should i do?

thank you so much


import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;

import com.badlogic.gdx.utils.viewport.ExtendViewport;
import com.badlogic.gdx.utils.viewport.FillViewport;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.StretchViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.uwsoft.editor.renderer.SceneLoader;
import com.uwsoft.editor.renderer.resources.ResourceManager;

public class MyGdxGame extends ApplicationAdapter {
    private SceneLoader sceneLoader;
        private ResourceManager rm;
    private Viewport viewport;
    private Camera camera;
    public void create () {

        rm = new ResourceManager();
    camera = new OrthographicCamera();
    viewport = new ExtendViewport(480 , 800, camera);
    sceneLoader = new SceneLoader(rm);
    sceneLoader.loadScene("MainScene", viewport);

public void render () {, 0, 0, 1);;

public void resize(int width, int height) {
    viewport.update(width, height);



1 Answers

wietze On

1) Is it abandoned? Is it advisable to use it or will it be abandoned soon?

If you are making a tile based game i would really recommend tiled :

It seems that further development of overlap2D has stopped but that shouldn't be a reason not to use it. Use that if you are making a game which contains platforms of different sizes and angles.

2) I created a simple screen with four images:

You are using ExtendViewport. This viewport keeps the world aspect ratio by axtending the world in one direction. In your second image you can clearly see that the world is extended to the right. I think what you want is to use FitViewport, this will always maintain the aspect ratio of the virtual screen size, while scaling it as much as possible to fit the entire screen.