Search in sources :

Example 1 with ApplicationListener

use of com.badlogic.gdx.ApplicationListener in project libgdx by libgdx.

the class LiveWallpaper method onCreateApplication.

@Override
public void onCreateApplication() {
    super.onCreateApplication();
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    ApplicationListener listener = new MyLiveWallpaperListener();
    initialize(listener, config);
}
Also used : ApplicationListener(com.badlogic.gdx.ApplicationListener) AndroidApplicationConfiguration(com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)

Example 2 with ApplicationListener

use of com.badlogic.gdx.ApplicationListener in project libgdx by libgdx.

the class TiledMapPacker method main.

/** Processes a directory of Tile Maps, compressing each tile set contained in any map once.
	 * 
	 * @param args args[0]: the input directory containing the tmx files (and tile sets, relative to the path listed in the tmx
	 *           file). args[1]: The output directory for the tmx files, should be empty before running. args[2-4] options */
public static void main(String[] args) {
    final Settings texturePackerSettings = new Settings();
    texturePackerSettings.paddingX = 2;
    texturePackerSettings.paddingY = 2;
    texturePackerSettings.edgePadding = true;
    texturePackerSettings.duplicatePadding = true;
    texturePackerSettings.bleed = true;
    texturePackerSettings.alias = true;
    texturePackerSettings.useIndexes = true;
    final TiledMapPackerSettings packerSettings = new TiledMapPackerSettings();
    if (args.length == 0) {
        printUsage();
        System.exit(0);
    } else if (args.length == 1) {
        inputDir = new File(args[0]);
        outputDir = new File(inputDir, "../output/");
    } else if (args.length == 2) {
        inputDir = new File(args[0]);
        outputDir = new File(args[1]);
    } else {
        inputDir = new File(args[0]);
        outputDir = new File(args[1]);
        processExtraArgs(args, packerSettings);
    }
    TiledMapPacker packer = new TiledMapPacker(packerSettings);
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    config.forceExit = false;
    config.width = 100;
    config.height = 50;
    config.title = "TiledMapPacker";
    new LwjglApplication(new ApplicationListener() {

        @Override
        public void resume() {
        }

        @Override
        public void resize(int width, int height) {
        }

        @Override
        public void render() {
        }

        @Override
        public void pause() {
        }

        @Override
        public void dispose() {
        }

        @Override
        public void create() {
            TiledMapPacker packer = new TiledMapPacker(packerSettings);
            if (!inputDir.exists()) {
                System.out.println(inputDir.getAbsolutePath());
                throw new RuntimeException("Input directory does not exist: " + inputDir);
            }
            try {
                packer.processInputDir(texturePackerSettings);
            } catch (IOException e) {
                throw new RuntimeException("Error processing map: " + e.getMessage());
            }
            System.out.println("Finished processing.");
            Gdx.app.exit();
        }
    }, config);
}
Also used : GdxRuntimeException(com.badlogic.gdx.utils.GdxRuntimeException) LwjglApplication(com.badlogic.gdx.backends.lwjgl.LwjglApplication) ApplicationListener(com.badlogic.gdx.ApplicationListener) LwjglApplicationConfiguration(com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration) IOException(java.io.IOException) File(java.io.File) Settings(com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings)

Example 3 with ApplicationListener

use of com.badlogic.gdx.ApplicationListener in project libgdx by libgdx.

the class Daydream method onAttachedToWindow.

@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    Log.i("Andrew", "hi");
    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    setInteractive(false);
    ApplicationListener app = new MeshShaderTest();
    initialize(app, cfg);
}
Also used : MeshShaderTest(com.badlogic.gdx.tests.MeshShaderTest) ApplicationListener(com.badlogic.gdx.ApplicationListener) AndroidApplicationConfiguration(com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)

Example 4 with ApplicationListener

use of com.badlogic.gdx.ApplicationListener in project libgdx by libgdx.

the class JglfwGraphics method sizeChanged.

void sizeChanged(int width, int height) {
    if (isMac) {
        // This is required to refresh the NSOpenGLContext on OSX!
        glfwShowWindow(window);
    }
    width = Math.max(1, width);
    height = Math.max(1, height);
    this.width = width;
    this.height = height;
    Gdx.gl.glViewport(0, 0, width, height);
    ApplicationListener listener = Gdx.app.getApplicationListener();
    if (listener != null)
        listener.resize(width, height);
    requestRendering();
}
Also used : ApplicationListener(com.badlogic.gdx.ApplicationListener)

Aggregations

ApplicationListener (com.badlogic.gdx.ApplicationListener)4 AndroidApplicationConfiguration (com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)2 LwjglApplication (com.badlogic.gdx.backends.lwjgl.LwjglApplication)1 LwjglApplicationConfiguration (com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration)1 MeshShaderTest (com.badlogic.gdx.tests.MeshShaderTest)1 Settings (com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings)1 GdxRuntimeException (com.badlogic.gdx.utils.GdxRuntimeException)1 File (java.io.File)1 IOException (java.io.IOException)1