Package com.badlogic.gdx.graphics.g2d

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


    public void bindGenericGDXImages() {
       
       
       
        TextureAtlas atlas = manager.get(pathToPackedGenericImages + "packedG.atlas", TextureAtlas.class);

        Array<AtlasRegion> regions = atlas.getRegions();
       
        Log.info("Amount of images to bind: "+regions.size);

        GDXImageCatalog newImage;
       
View Full Code Here


       
       
    }

    public void bindGDXImages() {
        TextureAtlas atlas = manager.get(Detonator.INSTANCE.gameDataDir + "/imgpacked/packed.atlas", TextureAtlas.class);

        Array<AtlasRegion> regions = atlas.getRegions();

        for (AtlasRegion ar : regions) {
            GDXImageCatalog.images.add(new GDXImageCatalog(ar));
        }
    }
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

  float stateTime;
  public Vector2 position;
 
  public Explosion(float x, float y, ExplosionType explosionType) {

        TextureAtlas atlas = ResourceManager.assets.get("effects/explosion.pack", TextureAtlas.class);
        String strType = null;

    switch (explosionType) {
    case CENTER:
            strType = "explosion_center";
      break;
    case UP:
            strType = "explosion_up";
      break;
    case DOWN:
            strType = "explosion_down";
      break;
    case LEFT:
            strType = "explosion_left";
      break;
    case RIGHT:
            strType = "explosion_right";
      break;
    case HORIZONTAL:
            strType = "explosion_horizontal";
      break;
    case VERTICAL:
            strType = "explosion_vertical";
      break;
    default:
            break;
    }

        animation = new Animation(0.2f, atlas.findRegions(strType));
    currentFrame = animation.getKeyFrame(0);
    position = new Vector2(x, y);
  }
View Full Code Here

    renderer.setPremultipliedAlpha(true); // PMA results in correct blending without outlines.
    debugRenderer = new SkeletonRendererDebug();
    debugRenderer.setBoundingBoxes(false);
    debugRenderer.setRegionAttachments(false);

    atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy.atlas"));
    SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
    json.setScale(0.6f); // Load the skeleton at 60% the size it was in Spine.
    SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy.json"));

    skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
View Full Code Here

   * @param minFilter
   * @param magFilter
   * @return the TextureAtlas
   */
  public synchronized TextureAtlas generateTextureAtlas (TextureFilter minFilter, TextureFilter magFilter) {
    TextureAtlas atlas = new TextureAtlas();
    for(Page page: pages) {
      if(page.rects.size != 0) {
        Texture texture = new Texture(new ManagedPixmapTextureData(page.image, page.image.getFormat(), true)) {
          @Override
          public void dispose () {
            super.dispose();
           
          }
        };
        texture.setFilter(minFilter, magFilter);
       
        Keys<String> names = page.rects.keys();
        for(String name: names) {
          Rectangle rect = page.rects.get(name);
          TextureRegion region = new TextureRegion(texture, (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);
          atlas.addRegion(name, region);
        }
      }
    }
    return atlas;
  }
View Full Code Here

    batch = new SpriteBatch();
    renderer = new SkeletonRenderer();
    renderer.setPremultipliedAlpha(true);
    debugRenderer = new SkeletonRendererDebug();

    atlas = new TextureAtlas(Gdx.files.internal("spineboy/spineboy.atlas"));
    SkeletonJson json = new SkeletonJson(atlas); // This loads skeleton JSON data, which is stateless.
    json.setScale(0.6f); // Load the skeleton at 60% the size it was in Spine.
    SkeletonData skeletonData = json.readSkeletonData(Gdx.files.internal("spineboy/spineboy.json"));

    skeleton = new Skeleton(skeletonData); // Skeleton holds skeleton state (bone positions, slot attachments, etc).
View Full Code Here

    renderer.setPremultipliedAlpha(true);
    debugRenderer = new SkeletonRendererDebug();

    final String name = "spineboy/spineboy";

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

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

    program = createShader();
    batch = new SpriteBatch();
    batch.setShader(program);
    renderer = new SkeletonRenderer();

    TextureAtlas atlas = new TextureAtlas(Gdx.files.internal(skeletonPath + "-diffuse.atlas"));
    atlasTexture = atlas.getRegions().first().getTexture();
    normalMapTexture = new Texture(Gdx.files.internal(skeletonPath + "-normal.png"));

    SkeletonJson json = new SkeletonJson(atlas);
    skeletonData = json.readSkeletonData(Gdx.files.internal(skeletonPath + ".json"));
    if (animationName != null) animation = skeletonData.findAnimation(animationName);
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.