Package com.badlogic.gdx.graphics.g2d

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


            getTextureData().consumePixmap().dispose();
          }
        };
        tex.setFilter(parameter.minFilter, parameter.magFilter);

        data.regions[i] = new TextureRegion(tex);
      }
    }
    return data;
  }
View Full Code Here


            getTextureData().consumePixmap().dispose();
          }
        };
        tex.setFilter(parameter.minFilter, parameter.magFilter);

        data.regions[i] = new TextureRegion(tex);
      }
    }
    return data;
  }
View Full Code Here

        int spriteWidth = texture.getWidth() / columns;
        int spriteHeight = texture.getHeight() / rows;

        for (int y = 0; y < rows; y++) {
            for (int x = 0; x < columns; x++) {
                TextureRegion textureRegion = new TextureRegion(
                          texture
                        , 0 + (x * spriteWidth)
                        , 0 + (y * spriteHeight)
                        , spriteWidth
                        , spriteHeight);
View Full Code Here

        int spriteWidth = texture.getWidth() / columns;
        int spriteHeight = texture.getHeight() / rows;

        for (int y = 0; y < rows; y++) {
            for (int x = 0; x < columns; x++) {
                TextureRegion textureRegion = new TextureRegion(
                          texture
                        , 0 + (x * spriteWidth)
                        , 0 + (y * spriteHeight)
                        , spriteWidth
                        , spriteHeight);
View Full Code Here

    }

    for (TextureDefinition definition : textureDefinitions)
    {
      Texture texture = new Texture(Gdx.files.internal(definition.getPath()));
      TextureRegion textureRegion = new TextureRegion(texture);

      textureAtlas.addRegion(definition.getName(), textureRegion);
      definitions.put(definition.getName(), definition);
    }
  }
View Full Code Here

  }

  /** Returns a registered texture region. If no region is found but a texture exists with the name, a region is created from the
   * texture and stored in the skin. */
  public TextureRegion getRegion (String name) {
    TextureRegion region = optional(name, TextureRegion.class);
    if (region != null) return region;

    Texture texture = optional(name, Texture.class);
    if (texture == null) throw new GdxRuntimeException("No TextureRegion or Texture registered with name: " + name);
    region = new TextureRegion(texture);
    add(name, region, Texture.class);
    return region;
  }
View Full Code Here

  public NinePatch getPatch (String name) {
    NinePatch patch = optional(name, NinePatch.class);
    if (patch != null) return patch;

    try {
      TextureRegion region = getRegion(name);
      if (region instanceof AtlasRegion) {
        int[] splits = ((AtlasRegion)region).splits;
        if (splits != null) {
          patch = new NinePatch(region, splits[0], splits[1], splits[2], splits[3]);
          int[] pads = ((AtlasRegion)region).pads;
View Full Code Here

  public Sprite getSprite (String name) {
    Sprite sprite = optional(name, Sprite.class);
    if (sprite != null) return sprite;

    try {
      TextureRegion textureRegion = getRegion(name);
      if (textureRegion instanceof AtlasRegion) {
        AtlasRegion region = (AtlasRegion)textureRegion;
        if (region.rotate || region.packedWidth != region.originalWidth || region.packedHeight != region.originalHeight)
          sprite = new AtlasSprite(region);
      }
View Full Code Here

    drawable = optional(name, TiledDrawable.class);
    if (drawable != null) return drawable;

    // Use texture or texture region. If it has splits, use ninepatch. If it has rotation or whitespace stripping, use sprite.
    try {
      TextureRegion textureRegion = getRegion(name);
      if (textureRegion instanceof AtlasRegion) {
        AtlasRegion region = (AtlasRegion)textureRegion;
        if (region.splits != null)
          drawable = new NinePatchDrawable(getPatch(name));
        else if (region.rotate || region.packedWidth != region.originalWidth || region.packedHeight != region.originalHeight)
View Full Code Here

  }

  /** Returns a tinted copy of a drawable found in the skin via {@link #getDrawable(String)}. */
  public Drawable newDrawable (Drawable drawable, Color tint) {
    if (drawable instanceof TextureRegionDrawable) {
      TextureRegion region = ((TextureRegionDrawable)drawable).getRegion();
      Sprite sprite;
      if (region instanceof AtlasRegion)
        sprite = new AtlasSprite((AtlasRegion)region);
      else
        sprite = new Sprite(region);
View Full Code Here

TOP

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

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.