Package com.badlogic.gdx.graphics.g2d

Examples of com.badlogic.gdx.graphics.g2d.TextureAtlas


   * @param inputDir The directory containing all the files created by TiledMapPacker */
  public TileAtlas (TiledMap map, FileHandle inputDir) {
    // TODO: Create a constructor that doesn't take a tmx map,
    for (TileSet set : map.tileSets) {
      FileHandle packfile = getRelativeFileHandle(inputDir, removeExtension(set.imageName) + " packfile");
      TextureAtlas textureAtlas = new TextureAtlas(packfile, packfile.parent(), false);
      List<AtlasRegion> atlasRegions = textureAtlas.findRegions(removeExtension(removePath(set.imageName)));

      for (AtlasRegion reg : atlasRegions) {
        regionsMap.put(reg.index + set.firstgid, reg);
        if (!textures.contains(reg.getTexture())) {
          textures.add(reg.getTexture());
View Full Code Here


  private static Map<String, Sound> sounds = new HashMap<String, Sound>();
    private static Map<String, TextureAtlas> atlases = new HashMap<String, TextureAtlas>();
 
  public static void loadAllResources() {

        TextureAtlas atlas;

    Texture.setEnforcePotImages(false);
    // Imágenes
    ResourceManager.loadResource("background", new Texture("backgrounds/farback.png"));
    ResourceManager.loadResource("ship_bullet", new Texture("ship/bullet.png"));
    ResourceManager.loadResource("shooter_bullet", new Texture("enemy/bullet.png"));
    ResourceManager.loadResource("bomb", new Texture("items/bomb.png"));
    ResourceManager.loadResource("shield", new Texture("items/shield.png"));
   
    // Onscreen information
    ResourceManager.loadResource("bomb_score", new Texture("items/bomb_score.png"));
    ResourceManager.loadResource("missile_score", new Texture("items/missile_score.png"));
   
    // Animaciones
        atlas = new TextureAtlas(Gdx.files.internal("ship/ship.pack"));
        ResourceManager.loadResource("ship", atlas);
    ResourceManager.loadResource("ship", new Animation(0.15f, atlas.findRegions("ship")));

        // Animación de nave pequeña
        atlas = new TextureAtlas(Gdx.files.internal("enemy/small.pack"));
    ResourceManager.loadResource("small_enemy", new Animation(0.15f, atlas.findRegions("small")));
        // Animación para la roca
        atlas = new TextureAtlas(Gdx.files.internal("enemy/stone.pack"));
    ResourceManager.loadResource("stone", new Animation(0.15f, atlas.findRegions("stone")));

    ResourceManager.loadResource("pursuer_enemy", ResourceManager.createAnimationFromSpriteSheet("enemy/pursuer.png", 6));
    ResourceManager.loadResource("shooter_enemy", ResourceManager.createAnimationFromSpriteSheet("enemy/shooter.png", 6));
    ResourceManager.loadResource("big_enemy", ResourceManager.createAnimationFromSpriteSheet("enemy/big.png", 6));
    ResourceManager.loadResource("missile", ResourceManager.createAnimationFromSpriteSheet("items/missile.png", 16));
        // Animación para las explosiones
        atlas = new TextureAtlas(Gdx.files.internal("explosion/explosion.pack"));
    ResourceManager.loadResource("explosion", new Animation(0.15f, atlas.findRegions("explosion")));

    //ResourceManager.loadResource("block", new SpriteSheet(new Image("res/items/blocks1.png"), 32, 32, 2, 2));

    // Sonidos
    ResourceManager.loadResource("shoot", Gdx.audio.newSound(Gdx.files.internal("sounds/disparo.mp3")));
View Full Code Here

  @Override
  public void show() {
    batch = new SpriteBatch();
    skin = new Skin();
    atlas = new TextureAtlas("data/buttons/button.pack");
    skin.addRegions(atlas);
    bonzai = new BitmapFont(Gdx.files.internal("data/fonts/bonzai32.fnt"),
        Gdx.files.internal("data/fonts/bonzai32.png"), false);
  }
View Full Code Here

  public void create () {
    batch = new SpriteBatch();
    renderer = new SkeletonRenderer();
    debugRenderer = new SkeletonRendererDebug();

    atlas = new TextureAtlas(Gdx.files.internal("spineboy.atlas"));
    SkeletonJson json = new SkeletonJson(atlas);
    SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy.json"));

    // Define mixing between animations.
    AnimationStateData stateData = new AnimationStateData(skeletonData);
View Full Code Here

    pixmap.fill();
    final AtlasRegion fake = new AtlasRegion(new Texture(pixmap), 0, 0, 32, 32);
    pixmap.dispose();
    FileHandle atlasFile = Gdx.files.internal(name + ".atlas");
    TextureAtlasData data = !atlasFile.exists() ? null : new TextureAtlasData(atlasFile, atlasFile.parent(), false);
    TextureAtlas atlas = new TextureAtlas(data) {
      public AtlasRegion findRegion (String name) {
        AtlasRegion region = super.findRegion(name);
        return region != null ? region : fake;
      }
    };
View Full Code Here

    renderer = new SkeletonRenderer();
    debugRenderer = new SkeletonRendererDebug();

    final String name = "spineboy";

    TextureAtlas atlas = new TextureAtlas(Gdx.files.internal(name + ".atlas"));

    if (true) {
      SkeletonJson json = new SkeletonJson(atlas);
      // json.setScale(2);
      skeletonData = json.readSkeletonData(Gdx.files.internal(name + ".json"));
View Full Code Here

  }

  @Override
  public void show() {
    batch = new SpriteBatch();
    atlas = new TextureAtlas("data/button.pack");
    skin = new Skin();
    skin.addRegions(atlas);
    white = new BitmapFont(Gdx.files.internal("data/whitefont.fnt"), false);
    black = new BitmapFont(Gdx.files.internal("data/font.fnt"), false);
  }
View Full Code Here

   */
  public void load(String packFile)
  {
    if (textureAtlas == null)
    {
      textureAtlas = new TextureAtlas(Gdx.files.internal(packFile));
    }
  }
View Full Code Here

   */
  public void load(List<TextureDefinition> textureDefinitions)
  {
    if (textureAtlas == null)
    {
      textureAtlas = new TextureAtlas();
    }
    else
    {
      dispose();

      textureAtlas = new TextureAtlas();
    }

    for (TextureDefinition definition : textureDefinitions)
    {
      Texture texture = new Texture(Gdx.files.internal(definition.getPath()));
View Full Code Here

   * extension exists, it is loaded as a {@link TextureAtlas} and the texture regions added to the skin. The atlas is
   * automatically disposed when the skin is disposed. */
  public Skin (FileHandle skinFile) {
    FileHandle atlasFile = skinFile.sibling(skinFile.nameWithoutExtension() + ".atlas");
    if (atlasFile.exists()) {
      atlas = new TextureAtlas(atlasFile);
      addRegions(atlas);
    }

    load(skinFile);
  }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.graphics.g2d.TextureAtlas

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.