Package com.badlogic.gdx.graphics.g2d

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


    String textureAtlasPath;
    if (parameter == null)
      textureAtlasPath = file.pathWithoutExtension() + ".atlas";
    else
      textureAtlasPath = parameter.textureAtlasPath;
    TextureAtlas atlas = manager.get(textureAtlasPath, TextureAtlas.class);
    return new Skin(file, atlas);
  }
View Full Code Here


    state = State.IDLE_RIGHT;
    this.spriteManager = spriteManager;
        dead = false;
   
    // Posiciones estáticas del personaje para izquierda y derecha en parado y salto
        TextureAtlas atlas = ResourceManager.assets.get("characters/characters.pack", TextureAtlas.class);
    idleLeft = atlas.findRegion("mario_idle_left");
    idleRight = atlas.findRegion("mario_idle_right");
    walkLeft = atlas.findRegion("mario_walk_left", 1);
    walkRight = atlas.findRegion("mario_walk_right", 1);
   
    // Crea la animación para correr hacia la derecha
    rightAnimation = new Animation(0.15f, atlas.findRegions("mario_walk_right"));
   
    // Crea la animación para correr hacia la izquierda
    leftAnimation = new Animation(0.15f, atlas.findRegions("mario_walk_left"));
  }
View Full Code Here

      FileHandle atlasFile = loadAtlas(root, tmxFile);
      if (atlasFile == null) {
        throw new GdxRuntimeException("Couldn't load atlas");
      }

      TextureAtlas atlas = new TextureAtlas(atlasFile);
      atlases.put(atlasFile.path(), atlas);

      AtlasResolver.DirectAtlasResolver atlasResolver = new AtlasResolver.DirectAtlasResolver(atlases);
      TiledMap map = loadMap(root, tmxFile, atlasResolver, parameter);
      map.setOwnedResources(atlases.values().toArray());
View Full Code Here

      }

      // get the TextureAtlas for this tileset
      FileHandle atlasHandle = getRelativeFileHandle(tmxFile, atlasFilePath);
      atlasHandle = resolve(atlasHandle.path());
      TextureAtlas atlas = resolver.getAtlas(atlasHandle.path());
      String regionsName = atlasHandle.nameWithoutExtension();

      if (parameter != null && parameter.forceTextureFilters) {
        for (Texture texture : atlas.getTextures()) {
          trackedTextures.add(texture);
        }
      }

      TiledMapTileSet tileset = new TiledMapTileSet();
      MapProperties props = tileset.getProperties();
      tileset.setName(name);
      props.put("firstgid", firstgid);
      props.put("imagesource", imageSource);
      props.put("imagewidth", imageWidth);
      props.put("imageheight", imageHeight);
      props.put("tilewidth", tilewidth);
      props.put("tileheight", tileheight);
      props.put("margin", margin);
      props.put("spacing", spacing);

      for (AtlasRegion region : atlas.findRegions(regionsName)) {
        // handle unused tile ids
        if (region != null) {
          StaticTiledMapTile tile = new StaticTiledMapTile(region);
          int tileid = firstgid + region.index;
          tile.setId(tileid);
          tile.setOffsetX(offsetX);
          tile.setOffsetY(-offsetY);
          tileset.putTile(tileid, tile);
        }
      }

      for (Element tileElement : element.getChildrenByName("tile")) {
        int tileid = firstgid + tileElement.getIntAttribute("id", 0);
        TiledMapTile tile = tileset.getTile(tileid);
        if (tile == null) {
          Element imageElement = tileElement.getChildByName("image");
          if (imageElement != null) {
            // Is a tilemap with individual images.
            String regionName = imageElement.getAttribute("source");
            regionName = regionName.substring(0, regionName.lastIndexOf('.'));
            AtlasRegion region = atlas.findRegion(regionName);
            if (region == null) throw new GdxRuntimeException("Tileset region not found: " + regionName);
            tile = new StaticTiledMapTile(region);
            tile.setId(tileid);
            tile.setOffsetX(offsetX);
            tile.setOffsetY(-offsetY);
View Full Code Here

        if(editor.isUsingDefaultTexture()) {
          JOptionPane.showMessageDialog(editor, "Load a Texture or an Atlas first.");
          return;
        }
       
        TextureAtlas atlas = editor.getAtlas();
        if(atlas != null)
          regionPickerPanel.setAtlas(atlas);
        else
          regionPickerPanel.setTexture(editor.getTexture());
       
View Full Code Here

      FileHandle atlasFile = loadAtlas(root, tmxFile);
      if (atlasFile == null) {
        throw new GdxRuntimeException("Couldn't load atlas");
      }

      TextureAtlas atlas = new TextureAtlas(atlasFile);
      atlases.put(atlasFile.path(), atlas);

      AtlasResolver.DirectAtlasResolver atlasResolver = new AtlasResolver.DirectAtlasResolver(atlases);
      TiledMap map = loadMap(root, tmxFile, atlasResolver, parameter);
      map.setOwnedResources(atlases.values().toArray());
View Full Code Here

      }

      // get the TextureAtlas for this tileset
      FileHandle atlasHandle = getRelativeFileHandle(tmxFile, map.getProperties().get("atlas", String.class));
      atlasHandle = resolve(atlasHandle.path());
      TextureAtlas atlas = resolver.getAtlas(atlasHandle.path());
      String regionsName = atlasHandle.nameWithoutExtension();

      if (parameter != null && parameter.forceTextureFilters) {
        for (Texture texture : atlas.getTextures()) {
          trackedTextures.add(texture);
        }
      }

      TiledMapTileSet tileset = new TiledMapTileSet();
      MapProperties props = tileset.getProperties();
      tileset.setName(name);
      props.put("firstgid", firstgid);
      props.put("imagesource", imageSource);
      props.put("imagewidth", imageWidth);
      props.put("imageheight", imageHeight);
      props.put("tilewidth", tilewidth);
      props.put("tileheight", tileheight);
      props.put("margin", margin);
      props.put("spacing", spacing);

      Array<AtlasRegion> regions = atlas.findRegions(regionsName);
      for (AtlasRegion region : regions) {
        // handle unused tile ids
        if (region != null) {
          StaticTiledMapTile tile = new StaticTiledMapTile(region);
View Full Code Here

    atlasButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed (ActionEvent e) {
        File file = editor.showFileLoadDialog();
        if(file != null){
          TextureAtlas atlas = editor.load(file.getAbsolutePath(), TextureAtlas.class, null,  null);
          if(atlas != null){
            editor.setAtlas(atlas);
          }
        }
      }
View Full Code Here

      FileHandle atlasFile = loadAtlas(root, tmxFile);
      if (atlasFile == null) {
        throw new GdxRuntimeException("Couldn't load atlas");
      }

      TextureAtlas atlas = new TextureAtlas(atlasFile);
      atlases.put(atlasFile.path(), atlas);

      AtlasResolver.DirectAtlasResolver atlasResolver = new AtlasResolver.DirectAtlasResolver(atlases);
      TiledMap map = loadMap(root, tmxFile, atlasResolver, parameter);
      map.setOwnedResources(atlases.values().toArray());
View Full Code Here

      }

      // get the TextureAtlas for this tileset
      FileHandle atlasHandle = getRelativeFileHandle(tmxFile, map.getProperties().get("atlas", String.class));
      atlasHandle = resolve(atlasHandle.path());
      TextureAtlas atlas = resolver.getAtlas(atlasHandle.path());
      String regionsName = atlasHandle.nameWithoutExtension();

      if (parameter != null && parameter.forceTextureFilters) {
        for (Texture texture : atlas.getTextures()) {
          trackedTextures.add(texture);
        }
      }

      TiledMapTileSet tileset = new TiledMapTileSet();
      MapProperties props = tileset.getProperties();
      tileset.setName(name);
      props.put("firstgid", firstgid);
      props.put("imagesource", imageSource);
      props.put("imagewidth", imageWidth);
      props.put("imageheight", imageHeight);
      props.put("tilewidth", tilewidth);
      props.put("tileheight", tileheight);
      props.put("margin", margin);
      props.put("spacing", spacing);

      Array<AtlasRegion> regions = atlas.findRegions(regionsName);
      for (AtlasRegion region : regions) {
        // handle unused tile ids
        if (region != null) {
          StaticTiledMapTile tile = new StaticTiledMapTile(region);
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.