简体   繁体   中英

Can't set config.height and config.width in LibGDX

I've recently started working on a Chess game in LibGDX. I can't figure how to set the desktop width and height.

Here is my Desktop Launcher code:

package com.mygdx.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
import com.mygdx.game.chess;

public class DesktopLauncher {
    public static void main (String[] arg) {
        Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
        config.setForegroundFPS(60);
        config.setTitle("Chess");
        config.height = 800;
        config.width = 800;
        new Lwjgl3Application(new chess(), config);
    }
}

I am also using a tutorial from 2020, perhaps the code is outdated, but I can't find any solution so far. Any help is appreciated.

Try this:

config.setWindowedMode(800, 800)

source code with the description is here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM