Java Code Examples for com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration#setWindowedMode()

The following examples show how to use com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration#setWindowedMode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DtdSchemaGenerator.java    From gdx-vfx with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
    Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
    config.disableAudio(true);
    config.setWindowedMode(1, 1);
    config.setTitle("");
    config.setInitialBackgroundColor(Color.VIOLET);

    new Lwjgl3Application(new ApplicationAdapter() {
        private Skin skin;

        @Override
        public void create() {
            skin = createSkin();
            LmlUtils.saveDtdSchema(new LmlParserBuilder(new DefaultLmlData())
                            .syntax(new CommonLmlSyntax())
                            .skin(skin)
                            .build(),
                    Gdx.files.local("demo/dtd/common.dtd"));
            Gdx.app.exit();
        }

        @Override
        public void dispose() {
            skin.dispose();
            skin = null;
        }
    }, config);
}
 
Example 2
Source File: DesktopLauncher.java    From gdx-vfx with Apache License 2.0 5 votes vote down vote up
public static void main (String[] arg) {
	Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
	config.setTitle("GDX VFX Demo");
	config.setWindowIcon(Files.FileType.Classpath,
			"gdx-vfx-icon16.png",
			"gdx-vfx-icon32.png",
			"gdx-vfx-icon64.png",
			"gdx-vfx-icon128.png");
	config.setWindowedMode(640, 480);

	new Lwjgl3Application(new App(), config);
}
 
Example 3
Source File: TalosLauncher.java    From talos with Apache License 2.0 5 votes vote down vote up
public static void main (String[] arg) {
	Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
	config.setWindowedMode(1200, 700);
	config.setTitle("Talos");
	config.useVsync(false);

	TalosMain talos = new TalosMain();

	new Lwjgl3Application(talos, config);
}
 
Example 4
Source File: Installer.java    From skin-composer with MIT License 5 votes vote down vote up
public static void main(String[] arg) {
    Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
    config.setDecorated(false);
    config.setWindowedMode(220, 180);
    config.setTitle("Skin Composer Installer");
    config.setWindowIcon("icon/logo-16.png", "icon/logo-32.png", "icon/logo-48.png", "icon/logo.png");
    Core core = new Core();
    Core.desktopWorker = new Installer();
    new Lwjgl3Application(core, config);
}
 
Example 5
Source File: Uninstaller.java    From skin-composer with MIT License 5 votes vote down vote up
public static void main(String[] arg) {
    Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
    config.setWindowedMode(220, 180);
    config.setDecorated(false);
    config.setWindowIcon("icon/logo-16.png", "icon/logo-32.png", "icon/logo-48.png", "icon/logo.png");
    config.setTitle("Skin Composer Uninstaller");
    Core.desktopWorker = new Uninstaller();
    new Lwjgl3Application(new Core(), config);
}
 
Example 6
Source File: ClientCompatibility.java    From Cubes with MIT License 5 votes vote down vote up
@Override
protected void run(ApplicationListener applicationListener) {
  Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();

  config.setWindowIcon(Files.FileType.Internal, "assets/icon-16x.png", "assets/icon-32x.png", "assets/icon-64x.png", "assets/icon-128x.png");
  config.useVsync(true);
  config.setWindowedMode(windowWidth, windowHeight);
  config.setWindowSizeLimits(768, 432, -1, -1);

  new Lwjgl3Application(applicationListener, config);
}
 
Example 7
Source File: TestLauncher.java    From vis-ui with Apache License 2.0 4 votes vote down vote up
public static void main (String[] args) {
	Lwjgl3ApplicationConfiguration c = new Lwjgl3ApplicationConfiguration();
	c.setTitle("VisUI test application");
	c.setWindowedMode(1280, 720);
	new Lwjgl3Application(new TestApplication(), c);
}
 
Example 8
Source File: DesktopLauncher.java    From shattered-pixel-dungeon with GNU General Public License v3.0 4 votes vote down vote up
public static void main (String[] args) {

		if (!DesktopLaunchValidator.verifyValidJVMState(args)){
			return;
		}
		
		final String title;
		if (DesktopLauncher.class.getPackage().getSpecificationTitle() == null){
			title = System.getProperty("Specification-Title");
		} else {
			title = DesktopLauncher.class.getPackage().getSpecificationTitle();
		}
		
		Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
			@Override
			public void uncaughtException(Thread thread, Throwable throwable) {
				Game.reportException(throwable);
				StringWriter sw = new StringWriter();
				PrintWriter pw = new PrintWriter(sw);
				throwable.printStackTrace(pw);
				pw.flush();
				String exceptionMsg = sw.toString();

				//shorten/simplify exception message to make it easier to fit into a message box
				exceptionMsg = exceptionMsg.replaceAll("\\(.*:([0-9]*)\\)", "($1)");
				exceptionMsg = exceptionMsg.replace("com.shatteredpixel.shatteredpixeldungeon.", "");
				exceptionMsg = exceptionMsg.replace("com.watabou.", "");
				exceptionMsg = exceptionMsg.replace("com.badlogic.gdx.", "");
				exceptionMsg = exceptionMsg.replace("\t", "    ");

				TinyFileDialogs.tinyfd_messageBox(title + " Has Crashed!",
						title + " has run into an error it can't recover from and has crashed, sorry about that!\n\n" +
						"If you could, please email this error message to the developer ([email protected]):\n\n" +
						"version: " + Game.version + "\n" +
						exceptionMsg,
						"ok", "error", false );
				if (Gdx.app != null) Gdx.app.exit();
			}
		});
		
		Game.version = DesktopLauncher.class.getPackage().getSpecificationVersion();
		if (Game.version == null) {
			Game.version = System.getProperty("Specification-Version");
		}
		
		try {
			Game.versionCode = Integer.parseInt(DesktopLauncher.class.getPackage().getImplementationVersion());
		} catch (NumberFormatException e) {
			Game.versionCode = Integer.parseInt(System.getProperty("Implementation-Version"));
		}

		if (UpdateImpl.supportsUpdates()){
			Updates.service = UpdateImpl.getUpdateService();
		}
		
		Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
		
		config.setTitle( title );
		
		String basePath = "";
		if (SharedLibraryLoader.isWindows) {
			if (System.getProperties().getProperty("os.name").equals("Windows XP")) {
				basePath = "Application Data/.shatteredpixel/Shattered Pixel Dungeon/";
			} else {
				basePath = "AppData/Roaming/.shatteredpixel/Shattered Pixel Dungeon/";
			}
		} else if (SharedLibraryLoader.isMac) {
			basePath = "Library/Application Support/Shattered Pixel Dungeon/";
		} else if (SharedLibraryLoader.isLinux) {
			basePath = ".shatteredpixel/shattered-pixel-dungeon/";
		}

		//copy over prefs from old file location from legacy desktop codebase
		FileHandle oldPrefs = new Lwjgl3FileHandle(basePath + "pd-prefs", Files.FileType.External);
		FileHandle newPrefs = new Lwjgl3FileHandle(basePath + SPDSettings.DEFAULT_PREFS_FILE, Files.FileType.External);
		if (oldPrefs.exists() && !newPrefs.exists()){
			oldPrefs.copyTo(newPrefs);
		}

		config.setPreferencesConfig( basePath, Files.FileType.External );
		SPDSettings.set( new Lwjgl3Preferences( SPDSettings.DEFAULT_PREFS_FILE, basePath) );
		FileUtils.setDefaultFileProperties( Files.FileType.External, basePath );
		
		config.setWindowSizeLimits( 480, 320, -1, -1 );
		Point p = SPDSettings.windowResolution();
		config.setWindowedMode( p.x, p.y );
		config.setAutoIconify( true );
		
		//we set fullscreen/maximized in the listener as doing it through the config seems to be buggy
		DesktopWindowListener listener = new DesktopWindowListener();
		config.setWindowListener( listener );
		
		config.setWindowIcon("icons/icon_16.png", "icons/icon_32.png", "icons/icon_64.png",
				"icons/icon_128.png", "icons/icon_256.png");

		new Lwjgl3Application(new ShatteredPixelDungeon(new DesktopPlatformSupport()), config);
	}