LibGDX - Resize

Again hello guys,

Now I have a new problem.
As I mentioned in my Thread before (About the bad FPS), I’ve made my own Snake project.
That project should have 3 Screens. The “MenuScreen”, “GameScreen” and “HighscoreScreen”.

My Main Class (Called Snake2D) extends Game. In that class I’d initialise my OrthographicCamera.
camera = new OrthographicCamera(600, 400);
camera.setToOrtho(false, 600, 400);

As you can see, the size of the window should be 600x400.
Now for the “GameScreen” I want to resize the window to 200x200.
In the tutorials from the wiki of LibGDX i’ve read something about the viewport and that I should change the viewport to resize my window.
But how can i do this?

Thats my Main-Class.

public class Snake2D extends Game {
	
	public SpriteBatch batch;
	public BitmapFont font;
	
	private OrthographicCamera camera;
	private Viewport viewport;
	
	@Override
	public void create () {
		batch = new SpriteBatch();
		font = new BitmapFont();
		
		camera = new OrthographicCamera(600, 400);
        camera.setToOrtho(false, 600, 400);
        
		this.setScreen(new MenuScreen(this));
	}

	@Override
	public void render () {
		Gdx.gl.glClearColor(1, 1, 1, 1);
		Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
		super.render();
	}
		
	@Override
	public void dispose() {
		batch.dispose();
		font.dispose();
	}

	@Override
	public void pause() {
		super.pause();
	}

	@Override
	public void resume() {
		super.resume();
	}

	@Override
	public void resize(int width, int height) {
		camera.setToOrtho(false, width, height);
		camera.update();
	}

And thats the part when I want to resize the window

			if(Gdx.input.getX() >= (Gdx.graphics.getWidth()-300)/2 && Gdx.input.getX() <= (Gdx.graphics.getWidth())/2+150){
				if(Gdx.input.getY() >= 85 && Gdx.input.getY() <= 185){
					Gdx.graphics.setDisplayMode(200, 200, false);
					game.resize(200, 200);
					dispose();
					game.setScreen(new GameScreen(game,name));
				}
			}

You can imagine… that it’s not working :smiley:
Can you help? :frowning: