Skip to content

libGDX launchers : cleaner UI

payne911 edited this page Oct 6, 2020 · 3 revisions

Pixels being pixels, it's hard to draw clean curves. Here are a few tweaks (essentially activating antialiasing) you can do to the libGDX launchers in order to obtain something which looks "cleaner":

antialiasing_gwt

Antialiasing is used to blur out the edges of shapes. You may want to avoid using this if you are working with pixel art, for example, because the art-style itself depends on having rough edges.

GwtLauncher

public class GwtLauncher extends GwtApplication {
	@Override
	public GwtApplicationConfiguration getConfig () {
		GwtApplicationConfiguration config = new GwtApplicationConfiguration(/*whatever*/);
		config.antialiasing = true;  // "smoother" rendering (through a "blur" of edges)
		// your other configs
		return config;
	}
}

DesktopLauncher

public class DesktopLauncher {
	public static void main(String[] arg) {
		LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
		config.samples = 4;  // "smoother" rendering (through a "blur" of edges)
		// your other configs
		new LwjglApplication(/*core ApplicationListener should already be here*/, config);
	}
}