List of usage examples for com.badlogic.gdx ApplicationAdapter ApplicationAdapter
ApplicationAdapter
From source file:com.jtransc.media.libgdx.JTranscLibgdx.java
License:Apache License
static public void init(final int windowWidth, final int windowHeight, final String windowTitle) { JTranscIO.impl = new JTranscIO.Impl() { @Override//from w ww .j a v a2 s . com public void readAsync(String path, JTranscCallback<byte[]> handler) { byte[] bytes = Gdx.files.internal(path).readBytes(); handler.handler(null, bytes); } @Override public void getResourceAsync(String path, JTranscCallback<byte[]> handler) { byte[] bytes = JTranscIoTools .readStreamFully(JTranscLibgdx.class.getClassLoader().getResourceAsStream(path)); handler.handler(null, bytes); } }; JTranscEventLoop.impl = new JTranscEventLoop.Impl() { @Override public void init(final Runnable init) { //final int width = windowWidth; //final int height = windowHeight; //final String title = windowTitle; //final String title = "JTransc " + JTranscVersion.getVersion(); ApplicationAdapter applicationAdapter = new ApplicationAdapter() { @Override public void create() { JTranscLibgdx.init(init); JTranscLibgdx.updatedScreenSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); } @Override public void render() { JTranscLibgdx.frame(); } @Override public void resize(int width, int height) { //System.out.println("resizing!!" + width + "x" + height); //JTranscWindow.setScreenSize(width, height); JTranscLibgdx.updatedScreenSize(width, height); //render(); } }; /* if (JTranscSystem.isMac()) { app = initLwjgl2(windowWidth, windowHeight, windowTitle, applicationAdapter); } else { app = initLwjgl3(windowWidth, windowHeight, windowTitle, applicationAdapter); } */ app = initLwjgl2(windowWidth, windowHeight, windowTitle, applicationAdapter); //app = initJglfw(width, height, title, applicationAdapter); } /* private Application initJglfw(final int width, final int height, final String title, final ApplicationAdapter appAdapter) { JglfwApplicationConfiguration config = new JglfwApplicationConfiguration(); config.width = width; config.height = height; config.title = title; config.stencil = 8; return new JglfwApplication(appAdapter, config); } */ private Application initLwjgl2(final int width, final int height, final String title, final ApplicationAdapter appAdapter) { LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); config.width = width; config.height = height; config.title = title; config.stencil = 8; config.useHDPI = true; return new LwjglApplication(appAdapter, config); } /* private Application initLwjgl3(final int width, final int height, final String title, final ApplicationAdapter appAdapter) { Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); config.setWindowedMode(width, height); config.setTitle(title); config.setHdpiMode(Lwjgl3ApplicationConfiguration.HdpiMode.Logical); //config.stencil = 8; return new Lwjgl3Application(appAdapter, config); } */ @Override public void loop(Runnable update, Runnable render) { JTranscLibgdx.r_update = update; JTranscLibgdx.r_render = render; } }; }