private void initApplication() { try { JglfwApplicationConfiguration cfg = new JglfwApplicationConfiguration(); cfg.preferencesLocation = String.format("tmp/%d/.prefs/", random.nextLong()); cfg.title = "Libgdx Runner"; cfg.width = 2; cfg.height = 2; cfg.forceExit = true; new JglfwApplication(new TestApplicationListener(), cfg); ConditionWaiter.wait(new Condition() { @Override public Boolean check() { return Gdx.files != null; } }, "Jglfw init failed.", 10); prefs = new File(Gdx.files.getExternalStoragePath(), "tmp/"); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { LibgdxRunner.this.safeCleanDir(); LibgdxRunner.this.closeGdxApplication(); } })); } catch (Exception ex) { throw new LibgdxInitException(ex); } }
/** Runs the {@link GdxTest} with the given name. * @param testName the name of a test class * @return {@code true} if the test was found and run, {@code false} otherwise */ public static JglfwApplication runTest (String testName) { final GdxTest test = GdxTests.newTest(testName); if (test == null) throw new GdxRuntimeException("Test not found: " + testName); final JglfwApplicationConfiguration config = new JglfwApplicationConfiguration(); config.width = 640; config.height = 480; config.title = testName; config.forceExit = false; return new JglfwApplication(test, config); }
public static void main (String[] argv) { // this is only here for me to debug native code faster new SharedLibraryLoader("../../extensions/gdx-audio/libs/gdx-audio-natives.jar").load("gdx-audio"); new SharedLibraryLoader("../../extensions/gdx-image/libs/gdx-image-natives.jar").load("gdx-image"); new SharedLibraryLoader("../../extensions/gdx-freetype/libs/gdx-freetype-natives.jar").load("gdx-freetype"); new SharedLibraryLoader("../../extensions/gdx-controllers/gdx-controllers-desktop/libs/gdx-controllers-desktop-natives.jar") .load("gdx-controllers-desktop"); new SharedLibraryLoader("../../gdx/libs/gdx-natives.jar").load("gdx"); GdxTest test = new SuperKoalio(); JglfwApplicationConfiguration config = new JglfwApplicationConfiguration(); config.vSync = true; new JglfwApplication(test, config); }
public static void main(String[] args) { Tile.SIZE = 360; init(); new JglfwApplication(new GdxMapApp(), getConfig()); }
public static void run(GdxMap map, JglfwApplicationConfiguration config, int tileSize) { Tile.SIZE = FastMath.clamp(tileSize, 128, 512); new JglfwApplication(map, (config == null ? getConfig() : config)); }