Package com.badlogic.gdx.graphics.g2d.TextureAtlas

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


    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);
      }
      if (sprite == null) sprite = new Sprite(textureRegion);
      add(name, sprite, NinePatch.class);
      return sprite;
    } catch (GdxRuntimeException ex) {
View Full Code Here


  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);
      sprite.setColor(tint);
      return new SpriteDrawable(sprite);
    }
    if (drawable instanceof NinePatchDrawable) {
      NinePatchDrawable patchDrawable = new NinePatchDrawable((NinePatchDrawable)drawable);
      patchDrawable.setPatch(new NinePatch(patchDrawable.getPatch(), tint));
      return patchDrawable;
    }
    if (drawable instanceof SpriteDrawable) {
      SpriteDrawable spriteDrawable = new SpriteDrawable((SpriteDrawable)drawable);
      Sprite sprite = spriteDrawable.getSprite();
      if (sprite instanceof AtlasSprite)
        sprite = new AtlasSprite((AtlasSprite)sprite);
      else
        sprite = new Sprite(sprite);
      sprite.setColor(tint);
      spriteDrawable.setSprite(sprite);
      return spriteDrawable;
View Full Code Here

TOP

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

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.