Example usage for com.badlogic.gdx Files internal

List of usage examples for com.badlogic.gdx Files internal

Introduction

In this page you can find the example usage for com.badlogic.gdx Files internal.

Prototype

public FileHandle internal(String path);

Source Link

Document

Convenience method that returns a FileType#Internal file handle.

Usage

From source file:es.eucm.ead.buildtools.GenerateBindings.java

License:Open Source License

public static void generateBindingsFile(String schemaFolder, String schemaPackage,
        String schemaBindingsLocation) {
    Files files = new LwjglFiles();
    String bindings = "[\n  ";
    bindings += addBindings(files.internal(schemaFolder + schemaPackage), schemaFolder);
    int lastComma = bindings.lastIndexOf(',');
    if (lastComma > 0) {
        bindings = bindings.substring(0, lastComma);
    }/*w w w  . j a  va  2 s  . com*/
    bindings += "\n]";
    new FileHandle(files.internal(schemaBindingsLocation).file()).writeString(bindings, false);
}

From source file:es.eucm.ead.buildtools.GenerateFieldClasses.java

License:Open Source License

public static void main(String[] args) {
    System.out.println("Generating Field classes ...");
    System.out.println();//from w  w  w. ja v a  2s  .c o m
    Files files = new LwjglFiles();
    Json json = new Json();
    FileHandle dir = files.internal(REPOCOMPONENTS_MAIN_PATH);
    // Generate fields classes for all repo classes
    buildCodeForAllClasses(files, json, dir, SCHEMAX_REPO_PACKAGE, EDITOR_SCHEMA_DESTFOLDER);
}

From source file:es.eucm.ead.buildtools.GenerateFieldClasses.java

License:Open Source License

private static String buildCode(Files files, Json json, String originJsonSchemaPath, String targetPackageName,
        String targetDirectory, boolean mainClass) {
    FileHandle fh = files.internal(originJsonSchemaPath);

    JsonValue next = json.fromJson(null, null, fh);
    next = next.child();/*  w  ww. ja v  a 2s  . c  o m*/

    String fieldsCode = "";
    String headerCode = "";
    String targetClassName = "";
    while ((next = next.next()) != null) {
        if (next.name().equals("properties")) {
            JsonValue nextProperty = next.child();
            fieldsCode += buildFields(nextProperty);
            break;
        } else if (next.name().equals("extends")) {
            String relativeParentJsonSchemaPath = next.child().asString();
            // Calculate directory to find parent class
            String parentJsonSchemaPath = originJsonSchemaPath.substring(0,
                    originJsonSchemaPath.lastIndexOf("/") + 1) + relativeParentJsonSchemaPath;
            fieldsCode += buildCode(files, json, parentJsonSchemaPath, null, null, false);
        } else if (next.name().equals("javaType") && mainClass) {
            String javaType = next.asString();
            String originalClassName = javaType.substring(javaType.lastIndexOf(".") + 1, javaType.length());
            targetClassName = originalClassName + "Fields";
            headerCode = getClassHeader(originalClassName, targetPackageName, targetClassName);
        }
    }

    if (mainClass) {
        if (fieldsCode.length() > 0) {
            System.out.println("Generating code for class " + targetClassName);
            String classCode = headerCode + fieldsCode + "}";
            writeClass(files, classCode, targetPackageName, targetClassName, targetDirectory);
            return classCode;
        } else {
            System.out.println("Skipping class " + targetClassName + " (no properties)");
            return "";
        }
    } else {
        return fieldsCode;
    }
}

From source file:es.eucm.ead.buildtools.GenerateFieldClasses.java

License:Open Source License

private static void writeClass(Files files, String classCode, String targetPackageName, String targetClassName,
        String targetDirectory) {
    FileHandle destDir = new FileHandle(
            files.internal(targetDirectory + targetPackageName.replaceAll("\\.", "/") + "/").file());
    destDir.mkdirs();//from  w  ww. j  a  v a 2s . c o  m
    FileHandle destFile = destDir.child(targetClassName + ".java");
    if (destFile.exists()) {
        destFile.delete();
    }
    destFile.writeString(classCode, false, "UTF-8");
}

From source file:es.eucm.ead.buildtools.GenerateSkin.java

License:Open Source License

public static void main(String[] args) {
    Files files = new LwjglFiles();

    Settings settings = new Settings();

    FileHandle rawRoot = files.internal(RAW_LOCATION);
    FileHandle skinsRoot = new FileHandle(files.internal(SKINS_LOCATION).file());

    for (FileHandle folder : rawRoot.list()) {
        if (folder.isDirectory()) {
            FileHandle skinFolder = skinsRoot.child(folder.name());
            skinFolder.mkdirs();/*from   w  w  w.  j ava  2  s  .  c om*/
            TexturePacker.process(settings, folder.child("images").file().getAbsolutePath(),
                    skinFolder.file().getAbsolutePath(), "skin");
            folder.child("fonts").copyTo(skinFolder);
            folder.child("skin.json").copyTo(skinFolder);
        }
    }
}

From source file:org.illarion.engine.backend.gdx.GdxFogEffect.java

License:Open Source License

GdxFogEffect(@Nonnull final Files files) {
    //noinspection SpellCheckingInspection
    shader = new ShaderProgram(files.internal("org/illarion/engine/backend/gdx/shaders/generic.vert"),
            files.internal("org/illarion/engine/backend/gdx/shaders/fog.frag"));
}

From source file:org.illarion.engine.backend.gdx.GdxGrayScaleEffect.java

License:Open Source License

GdxGrayScaleEffect(@Nonnull final Files files) {
    //noinspection SpellCheckingInspection
    shader = new ShaderProgram(files.internal("org/illarion/engine/backend/gdx/shaders/generic.vert"),
            files.internal("org/illarion/engine/backend/gdx/shaders/grayScale.frag"));
}

From source file:org.illarion.engine.backend.gdx.GdxHighlightEffect.java

License:Open Source License

/**
 * Create a new instance of the highlight effect.
 *
 * @param files the file system handler used to load the effect data
 *///from   w  w  w  .  j  av a  2  s.co  m
GdxHighlightEffect(@Nonnull final Files files) {
    //noinspection SpellCheckingInspection
    shader = new ShaderProgram(files.internal("org/illarion/engine/backend/gdx/shaders/generic.vert"),
            files.internal("org/illarion/engine/backend/gdx/shaders/highlight.frag"));
    highlightColor = new com.badlogic.gdx.graphics.Color();
}

From source file:org.illarion.engine.backend.gdx.GdxMiniMapEffect.java

License:Open Source License

/**
 * Create a new instance of the mini map effect.
 *
 * @param files    the file system handler used to load the effect data
 * @param worldMap the world map that is displayed
 *///from w  w  w  . j  av  a 2s .c  o  m
GdxMiniMapEffect(@Nonnull final Files files, @Nonnull final WorldMap worldMap) {
    //noinspection SpellCheckingInspection
    shader = new ShaderProgram(files.internal("org/illarion/engine/backend/gdx/shaders/generic.vert"),
            files.internal("org/illarion/engine/backend/gdx/shaders/minimap.frag"));
    this.worldMap = worldMap;

}

From source file:org.illarion.engine.backend.gdx.GdxTileLightEffect.java

License:Open Source License

GdxTileLightEffect(@Nonnull Files files) {
    //noinspection SpellCheckingInspection
    shader = new ShaderProgram(files.internal("org/illarion/engine/backend/gdx/shaders/generic.vert"),
            files.internal("org/illarion/engine/backend/gdx/shaders/tileLight.frag"));

    if (!shader.isCompiled()) {
        LOGGER.error("Compiling shader failed: {}", shader.getLog());
    }//from w w  w.ja v a2s. c  o m

    topLeft = new com.badlogic.gdx.graphics.Color();
    topRight = new com.badlogic.gdx.graphics.Color();
    bottomLeft = new com.badlogic.gdx.graphics.Color();
    bottomRight = new com.badlogic.gdx.graphics.Color();
    top = new com.badlogic.gdx.graphics.Color();
    bottom = new com.badlogic.gdx.graphics.Color();
    left = new com.badlogic.gdx.graphics.Color();
    right = new com.badlogic.gdx.graphics.Color();
    center = new com.badlogic.gdx.graphics.Color();
    topLeftCoord = new Vector2();
    bottomRightCoord = new Vector2();
}