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.blastedstudios.crittercaptors.CritterCaptors.java

License:Apache License

@Override
public void create() {
    //com.badlogic.gdx.graphics.g3d.model.still.StillModel model = 
    //   ModelLoaderRegistry.loadStillModel(Gdx.files.internal("data/models/base.g3dt"));
    //com.badlogic.gdx.graphics.g3d.loaders.g3d.chunks.G3dExporter.export(model, Gdx.files.absolute("data/models/base.g3d"));
    options = new OptionsUtil();
    creatureManager = new CreatureManager();
    textureMap = new HashMap<String, Texture>();
    textureMap.put("skydome", new Texture(Gdx.files.internal("data/sky/skydome.png"), Format.RGB565, true));
    textureMap.put("base", new Texture(Gdx.files.internal("data/textures/base.png"), Format.RGB565, true));
    textureMap.put("grass", new Texture(Gdx.files.internal("data/textures/grass1.jpg"), Format.RGB565, true));
    textureMap.get("grass").setFilter(TextureFilter.MipMap, TextureFilter.Nearest);
    textureMap.put("gravel", new Texture(Gdx.files.internal("data/textures/gravel1.jpg"), Format.RGB565, true));
    textureMap.get("gravel").setFilter(TextureFilter.MipMap, TextureFilter.Nearest);
    modelMap = new HashMap<String, Model>();
    modelMap.put("skydome", ModelLoaderRegistry.load(Gdx.files.internal("data/sky/skydome.obj")));
    modelMap.put("base", ModelLoaderRegistry.load(Gdx.files.internal("data/models/base.g3d")));
    for (String name : creatureManager.getCreatureTemplateNames()) {
        modelMap.put(name,/*from w  w w  . j av  a2  s  .c  o m*/
                ModelLoaderRegistry.load(Gdx.files.internal("data/models/" + name.toLowerCase() + ".g3d")));
        try {
            textureMap.put(name, new Texture(Gdx.files.internal("data/textures/" + name.toLowerCase() + ".png"),
                    Format.RGB565, true));
        } catch (Exception e) {
        }
    }
    Gdx.input.loadComplexGestures(Gdx.files.internal("data/gestures"));
    Gdx.input.removeComplexGestureListener(null);
    setScreen(new MainScreen(this));
}

From source file:com.blastedstudios.ledge.ui.postprocessing.utils.ShaderLoader.java

License:Apache License

public static ShaderProgram fromFile(String vertexFileName, String fragmentFileName, String defines) {
    String log = "\"" + vertexFileName + "/" + fragmentFileName + "\"";
    if (defines.length() > 0) {
        log += " w/ (" + defines.replace("\n", ", ") + ")";
    }/* w w  w.j a v a  2s  . co  m*/
    log += "...";
    Log.log("ShaderLoader", "Compiling " + log);

    String vpSrc = Gdx.files.internal(BasePath + vertexFileName + ".vertex").readString();
    String fpSrc = Gdx.files.internal(BasePath + fragmentFileName + ".fragment").readString();

    ShaderProgram program = ShaderLoader.fromString(vpSrc, fpSrc, vertexFileName, fragmentFileName, defines);
    return program;
}

From source file:com.blindtigergames.werescrewed.graphics.TextureAtlas.java

License:Apache License

/**
 * Loads the specified pack file using {@link FileType#Internal}, using the
 * parent directory of the pack file to find the page images.
 *///from ww w .j a v a2  s. c o m
public TextureAtlas(String internalPackFile) {
    this(Gdx.files.internal(internalPackFile));
}

From source file:com.bombinggames.isthisme.GameScreen.java

public GameScreen(IsThisMe game) {
    this.game = game;

    TextureRegion[] anim = new TextureRegion[] {
            new TextureRegion(new Texture(Gdx.files.internal("com/bombinggames/isthisme/graphics/w1.png"))),
            new TextureRegion(new Texture(Gdx.files.internal("com/bombinggames/isthisme/graphics/w2.png"))),
            new TextureRegion(new Texture(Gdx.files.internal("com/bombinggames/isthisme/graphics/w3.png"))) };
    walkinAnimation = new Animation(300f, anim);
    walkinAnimation.setPlayMode(Animation.PlayMode.LOOP);

    anim = new TextureRegion[] {
            new TextureRegion(new Texture(Gdx.files.internal("com/bombinggames/isthisme/graphics/h1.png"))),
            new TextureRegion(new Texture(Gdx.files.internal("com/bombinggames/isthisme/graphics/h2.png"))) };
    hitAnimation = new Animation(300f, anim);
    hitAnimation.setPlayMode(Animation.PlayMode.NORMAL);
    overlay.setColor(0, 0, 0, 1);/* ww  w.  j a  va 2 s  .  c o m*/
}

From source file:com.bombinggames.isthisme.GameScreen.java

public void setupDeath() {
    background = new Sprite(new Texture("com/bombinggames/isthisme/graphics/backgroundDeath.jpg"));
    stream = new Sprite(new Texture("com/bombinggames/isthisme/graphics/stream.png"));
    walls = new Sprite(new Texture("com/bombinggames/isthisme/graphics/walls.png"));
    street = new Sprite(new Texture("com/bombinggames/isthisme/graphics/street.png"));
    flash = new Sprite(new Texture("com/bombinggames/isthisme/graphics/light.png"));

    stream.setX(-200);//from   ww  w .  ja  v a 2 s.co  m
    stream.setY(Gdx.graphics.getHeight() - stream.getHeight());
    flash.setPosition(630, 400);
    street.setX(450);
    music = Gdx.audio.newMusic(Gdx.files.internal("com/bombinggames/isthisme/music/blowjob.mp3"));
    p1Pos.x = 680;
    deathmode = true;
}

From source file:com.bossletsplays.rr.utils.Files.java

License:Apache License

/**
 * @param path the path to the file, relative to the jar
 * @return A file inside the jar/*from  www  .  ja va2s  . c om*/
 */
public static FileHandle internal(String path) {
    return Gdx.files.internal(path);
}

From source file:com.bossletsplays.rr.utils.Files.java

License:Apache License

/**
 * @param path the path to the file, relative to the directory containing
 *            the jar//from  w  w w . ja v  a  2s  .  c o m
 * @return A file outside the jar
 */
public static FileHandle external(String path) {
    return Gdx.files.external(path);
}

From source file:com.bsencan.openchess.Assets.java

License:Apache License

public static void loadMainMenu() {
    gameAtlas = new TextureAtlas(Gdx.files.internal("atlases/open-chess-image.pack"));
    skin = new Skin(Gdx.files.internal("skin-labels.json"), gameAtlas);
    menuMusic = Gdx.audio.newMusic(Gdx.files.internal("music/fortress.ogg"));
}

From source file:com.bsencan.openchess.Assets.java

License:Apache License

/**
 * Loads all assets required by {@link GameScreen}.
 *//*from w w  w .  j av a  2  s  .  co  m*/
public static void loadGame() {
    gameAtlas = new TextureAtlas(Gdx.files.internal("atlases/open-chess-image.pack"));
    skin = new Skin(Gdx.files.internal("skin-all.json"), gameAtlas);
}

From source file:com.bss.game.Assets.java

License:Apache License

public static void load() {

    font = new BitmapFont(Gdx.files.internal("rlfont.fnt"), Gdx.files.internal("rlfont.png"), false);

    ta = new TextureAtlas(Gdx.files.internal("madfishing.pack"));

    backgroundRegion = ta.findRegion("background2");
    soundOn = ta.findRegion("soundon");
    soundOff = ta.findRegion("soundoff");
    logo = ta.findRegion("title");
    play = ta.findRegion("play");
    quit = ta.findRegion("quit");
    help = ta.findRegion("helpscreen");
    ready = ta.findRegion("ready");
    resume = ta.findRegion("resume");
    pause = ta.findRegion("pause2");
    highscores = ta.findRegion("highscores");
    slappySeal = ta.findRegion("coloredslappysealwrods");
    hook = ta.findRegion("hooksmaller");
    gameOver = ta.findRegion("gameover");
    arrow = ta.findRegion("arrow");
    arrowFlipped = ta.findRegion("arrow");
    arrowFlipped.flip(true, false);// ww  w.j  a v a2s .co  m

    greenPatch = ta.findRegion("greenpatch");
    redPatch = ta.findRegion("redpatch");

    hook2 = ta.findRegion("hookcircle");

    alligator = ta.findRegion("alligatorbad");
    angel = ta.findRegion("angelfishGood");
    big = ta.findRegion("biggestGoodFish");
    bigOrange = ta.findRegion("bigGoodFish");
    blowFish = ta.findRegion("blowbadfish");
    blueFish = ta.findRegion("blueGoodFish");
    clown = ta.findRegion("clownGoodFish");
    dolphin = ta.findRegion("dolphinGood");
    goldie = ta.findRegion("goldieGoodFish");
    greenFish = ta.findRegion("greenGoodFish");
    oldFish = ta.findRegion("oldFishBad");
    perch = ta.findRegion("perchGoodFish");
    plainFish = ta.findRegion("plainGoodFish");
    rare = ta.findRegion("rareGoodFish");
    shark = ta.findRegion("sharkBad");
    swordfish = ta.findRegion("swordfishGood");
    trout = ta.findRegion("troutGoodFish");
    whale = ta.findRegion("whalebad");

    //font = new BitmapFont(Gdx.files.internal("data/font.fnt"), Gdx.files.internal("data/font.png"), false);

    // Create (or retrieve existing) preferences file
    prefs = Gdx.app.getPreferences("MadFishing");

    // Provide default high score of 0
    if (!prefs.contains("highScore")) {
        prefs.putLong("highScore", 0l);
    }
    if (!prefs.contains("sound")) {
        prefs.putBoolean("sound", true);
    }

    music = Gdx.audio.newMusic(Gdx.files.internal("ObservingTheStar.ogg"));
    music.setLooping(true);
    music.setVolume(0.5f);
    if (getSound())
        music.play();
    clickSound = Gdx.audio.newSound(Gdx.files.internal("pop.ogg"));

}