Example usage for com.badlogic.gdx Gdx files

List of usage examples for com.badlogic.gdx Gdx files

Introduction

In this page you can find the example usage for com.badlogic.gdx Gdx files.

Prototype

Files files

To view the source code for com.badlogic.gdx Gdx files.

Click Source Link

Usage

From source file:com.github.fauu.helix.manager.AreaManager.java

License:Open Source License

public Array<String> getAllNames() {
    Array<String> names = new Array<String>();

    FileHandle directory = Gdx.files.internal("area");

    for (FileHandle entry : directory.list()) {
        if (entry.extension().equalsIgnoreCase("json")) {
            names.add(entry.nameWithoutExtension());
        }/*from w w  w  . j av  a 2s .  c  o  m*/
    }

    return names;
}

From source file:com.github.fauu.helix.manager.WeatherMan.java

License:Open Source License

public void setToType(WeatherType type) {
    Environment environment = new Environment();
    Bloom bloom = null;//w w w . j  a v  a 2s  . co  m
    ParticleEffect precipitationEffect = null;

    switch (type) {
    case NONE:
        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1, 1, 1, 1));
        break;
    case SUNNY:
        bloom = new Bloom();
        bloom.setBloomIntesity(1.1f);
        bloom.setOriginalIntesity(1);

        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, 1, 1, 1, 1));
        break;
    case OVERCAST:
        bloom = new Bloom();
        bloom.setBloomIntesity(.6f);
        bloom.setOriginalIntesity(.8f);

        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .8f, .8f, .8f, 1));
        break;
    case RAINSTORM:
        bloom = new Bloom();
        bloom.setBloomIntesity(.2f);
        bloom.setOriginalIntesity(.2f);

        environment.set(new ColorAttribute(ColorAttribute.AmbientLight, .5f, .5f, .6f, 1));
        environment.set(new ColorAttribute(ColorAttribute.Fog, 1, 1, 1, 1));

        precipitationEffect = new ParticleEffect();
        precipitationEffect.load(Gdx.files.internal("effect/rain.p"), Gdx.files.internal("effect"));
        precipitationEffect.setPosition(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2);
        precipitationEffect.start();
        break;
    default:
        throw new IllegalStateException();
    }

    weather.setEnvironment(environment);
    weather.setBloom(bloom);
    weather.setParticleEffect(precipitationEffect);
}

From source file:com.github.unluckyninja.defenseofhuman.MenuScreen.java

License:Open Source License

private void tempCreate() {
    TextureAtlas atlas = new TextureAtlas(Gdx.files.internal("textures/characters/test.pack"));
    Array<TextureAtlas.AtlasRegion> regions = atlas.findRegions("running");
    animation = new Animation(0.15f, regions, Animation.LOOP);
}

From source file:com.github.unluckyninja.defenseofhuman.view.renderer.PlayerRenderer.java

License:Open Source License

public PlayerRenderer(TextureAtlas atlas) {
    if (atlas == null) {
        atlas = new TextureAtlas(Gdx.files.internal("textures/characters/test.pack"));
    }/*from   ww w  .  j ava  2s  . co  m*/
    this.atlas = atlas;
    loadAtlas(atlas);
}

From source file:com.github.unluckyninja.mousekiller.graphics.shader.SimpleShader.java

License:Open Source License

public SimpleShader() {
    super(Gdx.files.internal("com/github/unluckyninja/mousekiller/graphics/shader/SimpleVertexShader.txt"),
            Gdx.files.internal("com/github/unluckyninja/mousekiller/graphics/shader/SimpleFragmentShader.txt"));
}

From source file:com.github.unluckyninja.mousekiller.graphics.TextRenderer.java

License:Open Source License

/**
 * ????/*  w w w . j a va2s.  c  o  m*/
 *
 * @param i
 */
public void readTextures(int i) {
    if (pixmaps[i] != null) {
        return;
    }
    String s = String.format("res/textures/font/unicode_page_%02X.png", new Object[] { Integer.valueOf(i) });
    FileHandle file = Gdx.files.internal(s);
    if (file.exists()) {
        try {
            BufferedImage image = ImageIO.read(file.read());
            Pixmap map = new Pixmap(256, 256, Pixmap.Format.RGBA8888);
            int[] colors = new int[65536];
            for (int j = 0; j < 65536; j++) {
                colors[j] = 0;
            }
            image.getData().getPixels(0, 0, 256, 256, (int[]) colors);
            ByteBuffer pixels = map.getPixels();
            pixels.clear();
            pixels.put(readColor(colors));
            pixels.position(0);
            pixmaps[i] = map;
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}

From source file:com.github.unluckyninja.mousekiller.graphics.TextRenderer.java

License:Open Source License

private void readGlyphSizes() {
    this.glyphWidth = Gdx.files.internal("res/font/glyph_sizes.bin").readBytes();
}

From source file:com.github.unluckyninja.mousekiller.graphics.TextRenderer.java

License:Open Source License

/**
 * Load the font.txt resource file, that is on UTF-8 format. This file
 * contains the characters that minecraft can render Strings on screen.
 *//*  www .  j  ava 2 s  .  co  m*/
private static String getAllowedCharacters() {
    StringBuilder s = new StringBuilder(4096);
    try (BufferedReader bufferedreader = Gdx.files.internal("res/font.txt").reader(1024, "UTF-8")) {
        String s1 = "";

        while ((s1 = bufferedreader.readLine()) != null) {
            if (!s1.startsWith("#")) {
                s = s.append(s1);
            }
        }
    } catch (IOException ex) {
        Logger.getLogger(TextRenderer.class.getName()).log(Level.SEVERE, null, ex);
    }

    return s.toString();
}

From source file:com.github.unluckyninja.mousekiller.MainMenu.java

License:Open Source License

public MainMenu(MouseKiller mk, SpriteBatch batch) {
    this.mk = mk;
    bgm = Gdx.audio.newMusic(Gdx.files.internal("HeyThere1.ogg"));
    bgm.setLooping(true);//from   www . j a va  2  s .  com
    camera = new OrthographicCamera();
    stage = new Stage(MouseKiller.width, MouseKiller.height, true, mk.batch);

    bodyDef.position.set(20, 20);
    bodyDef.type = BodyDef.BodyType.KinematicBody;
    bodyDef.linearDamping = 0;
    box.setAsBox(2, 2);

    ShaderProgram.pedantic = false;

}

From source file:com.github.ykrasik.jerminal.libgdx.ConsoleBuilder.java

License:Apache License

/**
 * Constructs a console from the fileSystem using the default skin.
 *
 * @param fileSystem FileSystem to use.//from www  .ja v a  2 s.c o m
 */
public ConsoleBuilder(ShellFileSystem fileSystem) {
    this(fileSystem, new Skin(Gdx.files.classpath("com/github/ykrasik/jerminal/libgdx/console.cfg")));
}