Search in sources :

Example 1 with Application

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

the class ShaderProgram method getManagedStatus.

public static String getManagedStatus() {
    StringBuilder builder = new StringBuilder();
    int i = 0;
    builder.append("Managed shaders/app: { ");
    for (Application app : shaders.keys()) {
        builder.append(shaders.get(app).size);
        builder.append(" ");
    }
    builder.append("}");
    return builder.toString();
}
Also used : Application(com.badlogic.gdx.Application)

Example 2 with Application

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

the class Controllers method initialize.

private static void initialize() {
    if (managers.containsKey(Gdx.app))
        return;
    String className = null;
    ApplicationType type = Gdx.app.getType();
    ControllerManager manager = null;
    if (type == ApplicationType.Android) {
        if (Gdx.app.getVersion() >= 12) {
            className = "com.badlogic.gdx.controllers.android.AndroidControllers";
        } else {
            Gdx.app.log(TAG, "No controller manager is available for Android versions < API level 12");
            manager = new ControllerManagerStub();
        }
    } else if (type == ApplicationType.Desktop) {
        if (Gdx.graphics.getType() == GraphicsType.LWJGL3) {
            className = "com.badlogic.gdx.controllers.lwjgl3.Lwjgl3ControllerManager";
        } else {
            className = "com.badlogic.gdx.controllers.desktop.DesktopControllerManager";
        }
    } else if (type == ApplicationType.WebGL) {
        className = "com.badlogic.gdx.controllers.gwt.GwtControllers";
    } else {
        Gdx.app.log(TAG, "No controller manager is available for: " + Gdx.app.getType());
        manager = new ControllerManagerStub();
    }
    if (manager == null) {
        try {
            Class controllerManagerClass = ClassReflection.forName(className);
            manager = (ControllerManager) ClassReflection.newInstance(controllerManagerClass);
        } catch (Throwable ex) {
            throw new GdxRuntimeException("Error creating controller manager: " + className, ex);
        }
    }
    managers.put(Gdx.app, manager);
    final Application app = Gdx.app;
    Gdx.app.addLifecycleListener(new LifecycleListener() {

        @Override
        public void resume() {
        }

        @Override
        public void pause() {
        }

        @Override
        public void dispose() {
            managers.remove(app);
            Gdx.app.log(TAG, "removed manager for application, " + managers.size + " managers active");
        }
    });
    Gdx.app.log(TAG, "added manager for application, " + managers.size + " managers active");
}
Also used : GdxRuntimeException(com.badlogic.gdx.utils.GdxRuntimeException) ApplicationType(com.badlogic.gdx.Application.ApplicationType) LifecycleListener(com.badlogic.gdx.LifecycleListener) Application(com.badlogic.gdx.Application)

Example 3 with Application

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

the class TextureArray method getManagedStatus.

public static String getManagedStatus() {
    StringBuilder builder = new StringBuilder();
    builder.append("Managed TextureArrays/app: { ");
    for (Application app : managedTextureArrays.keySet()) {
        builder.append(managedTextureArrays.get(app).size);
        builder.append(" ");
    }
    builder.append("}");
    return builder.toString();
}
Also used : Application(com.badlogic.gdx.Application)

Example 4 with Application

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

the class Cubemap method getManagedStatus.

public static String getManagedStatus() {
    StringBuilder builder = new StringBuilder();
    builder.append("Managed cubemap/app: { ");
    for (Application app : managedCubemaps.keySet()) {
        builder.append(managedCubemaps.get(app).size);
        builder.append(" ");
    }
    builder.append("}");
    return builder.toString();
}
Also used : Application(com.badlogic.gdx.Application)

Example 5 with Application

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

the class Mesh method getManagedStatus.

public static String getManagedStatus() {
    StringBuilder builder = new StringBuilder();
    int i = 0;
    builder.append("Managed meshes/app: { ");
    for (Application app : meshes.keySet()) {
        builder.append(meshes.get(app).size);
        builder.append(" ");
    }
    builder.append("}");
    return builder.toString();
}
Also used : Application(com.badlogic.gdx.Application)

Aggregations

Application (com.badlogic.gdx.Application)8 ApplicationType (com.badlogic.gdx.Application.ApplicationType)1 LifecycleListener (com.badlogic.gdx.LifecycleListener)1 Texture (com.badlogic.gdx.graphics.Texture)1 GdxRuntimeException (com.badlogic.gdx.utils.GdxRuntimeException)1 ObjectMap (com.badlogic.gdx.utils.ObjectMap)1 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1