public HeadlessApplication(ApplicationListener listener, HeadlessApplicationConfiguration config) { if (config == null) config = new HeadlessApplicationConfiguration(); HeadlessNativesLoader.load(); setApplicationLogger(new HeadlessApplicationLogger()); this.listener = listener; this.files = new HeadlessFiles(); this.net = new HeadlessNet(config); // the following elements are not applicable for headless applications // they are only implemented as mock objects this.graphics = new MockGraphics(); this.audio = new MockAudio(); this.input = new MockInput(); this.preferencesdir = config.preferencesDirectory; Gdx.app = this; Gdx.files = files; Gdx.net = net; Gdx.audio = audio; Gdx.graphics = graphics; Gdx.input = input; renderInterval = config.renderInterval > 0 ? (long)(config.renderInterval * 1000000000f) : (config.renderInterval < 0 ? -1 : 0); initialize(); }
public HeadlessApplication(ApplicationListener listener, HeadlessApplicationConfiguration config) { if (config == null) config = new HeadlessApplicationConfiguration(); HeadlessNativesLoader.load(); setApplicationLogger(new HeadlessApplicationLogger()); this.listener = listener; this.files = new HeadlessFiles(); this.net = new HeadlessNet(config); // the following elements are not applicable for headless applications // they are only implemented as mock objects this.graphics = new MockGraphics(); this.audio = new MockAudio(); this.input = new MockInput(); this.preferencesdir = config.preferencesDirectory; Gdx.app = this; Gdx.files = files; Gdx.net = net; Gdx.audio = audio; Gdx.graphics = graphics; Gdx.input = input; renderInterval = config.renderInterval > 0 ? (long)(config.renderInterval * 1000000000f) : (config.renderInterval < 0 ? -1 : 0); initialize(); }
public class HeadlessLauncher { public static void main(final String[] args) { final HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); config.renderInterval = Globals.TICK_RATE; // Likely want 1f/60 for 60 fps new HeadlessApplication(new MyApplication(), config); } }
public GdxTestRunner(Class<?> klass) throws InitializationError { super(klass); HeadlessApplicationConfiguration conf = new HeadlessApplicationConfiguration(); Gdx.app = new HeadlessApplication(this, conf); Gdx.gl = mock(GL20.class); }
HeadlessNativesLoader.load(); MockGraphics mockGraphics = new MockGraphics(); Gdx.graphics = mockGraphics; HeadlessNet headlessNet = new HeadlessNet(); Gdx.net = headlessNet; HeadlessFiles headlessFiles = new HeadlessFiles(); Gdx.files = headlessFiles; Gdx.gl = mock(GL20.class); HeadlessApplicationConfiguration config = new HeadlessApplicationConfiguration(); ApplicationListener myGdxGame = EntryPoint.getHeadlessMyGdxGame(config);
public static void init() { if (initialized) { return; } initialized = true; GL20 mockGL = new MockGL(); Gdx.gl = mockGL; Gdx.gl20 = mockGL; final HeadlessApplication application = new HeadlessApplication(new SolApplication(100), new HeadlessApplicationConfiguration()); try { Thread.sleep(10000L); // Magic happens here. If too much tests fail for you, increase this number. } catch (InterruptedException e) { e.printStackTrace(); } game = ((SolApplication) application.getApplicationListener()).getGame(); } }
public HeadlessApplication(ApplicationListener listener, HeadlessApplicationConfiguration config) { if (config == null) config = new HeadlessApplicationConfiguration(); HeadlessNativesLoader.load(); setApplicationLogger(new HeadlessApplicationLogger()); this.listener = listener; this.files = new HeadlessFiles(); this.net = new HeadlessNet(); // the following elements are not applicable for headless applications // they are only implemented as mock objects this.graphics = new MockGraphics(); this.audio = new MockAudio(); this.input = new MockInput(); this.preferencesdir = config.preferencesDirectory; Gdx.app = this; Gdx.files = files; Gdx.net = net; Gdx.audio = audio; Gdx.graphics = graphics; Gdx.input = input; renderInterval = config.renderInterval > 0 ? (long)(config.renderInterval * 1000000000f) : (config.renderInterval < 0 ? -1 : 0); initialize(); }
public HeadlessApplication(ApplicationListener listener, HeadlessApplicationConfiguration config) { if (config == null) config = new HeadlessApplicationConfiguration(); HeadlessNativesLoader.load(); setApplicationLogger(new HeadlessApplicationLogger()); this.listener = listener; this.files = new HeadlessFiles(); this.net = new HeadlessNet(config); // the following elements are not applicable for headless applications // they are only implemented as mock objects this.graphics = new MockGraphics(); this.audio = new MockAudio(); this.input = new MockInput(); this.preferencesdir = config.preferencesDirectory; Gdx.app = this; Gdx.files = files; Gdx.net = net; Gdx.audio = audio; Gdx.graphics = graphics; Gdx.input = input; renderInterval = config.renderInterval > 0 ? (long)(config.renderInterval * 1000000000f) : (config.renderInterval < 0 ? -1 : 0); initialize(); }