简体   繁体   English

如何让我的 JAVA 应用程序只影响单个屏幕?

[英]How do I make my JAVA-application only affect a single screen?

It actually only runs on one screen.它实际上只在一个屏幕上运行。 But to my annoyance the other screen turns black , I would like to have it unaffected so that I can see stuff on it during development.但令我烦恼的是,另一个屏幕变黑了,我希望它不受影响,这样我就可以在开发过程中看到上面的东西。

NOTE: My application is based on the libGDX framework .注意:我的应用程序基于libGDX 框架

DesktopLauncher桌面启动器

public static void main (String[] arg)
{
    // Build Texture Atlases
    if (rebuildAtlas) {
        Settings settings = new Settings();
        settings.maxWidth = 1024;
        settings.maxHeight = 1024;
        settings.combineSubdirectories = true;

        // Pack images in "textures" folder
        TexturePacker.process("assets/textures", "assets/atlas", "textures.atlas");
    }   
    
    LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();

    cfg.title = "LoA";
    cfg.useGL30 = false;
    cfg.width = Cn.RESOLUTION_WIDTH;
    cfg.height = Cn.RESOLUTION_HEIGHT;
    cfg.fullscreen = true;
    
    new LwjglApplication(new LoA(), cfg);
}

Don't use fullscreen = true .不要使用fullscreen = true

Fullscreen means that the normal desktop is replaced by a new separate desktop dedicated to the program, and the desktop covers all screens.全屏是指将普通桌面替换为程序专用的新独立桌面,桌面覆盖所有屏幕。

You need to run in Windowed mode, with a window that is maximized to one screen, so the other screen still shows the original desktop.您需要在窗口模式下运行,window 最大化到一个屏幕,所以另一个屏幕仍然显示原始桌面。

Lots of games have the Fullscreen vs Windowed mode option, in case you want to see it in effect.许多游戏都有全屏与窗口模式选项,以防您想看到它的效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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