Java 类com.badlogic.gdx.graphics.g2d.TextureAtlas.AtlasSprite 实例源码

项目:ingress-indonesia-dev    文件:Skin.java   
public Sprite getSprite(String paramString)
{
  Object localObject = (Sprite)optional(paramString, Sprite.class);
  if (localObject != null)
    return localObject;
  try
  {
    TextureRegion localTextureRegion = getRegion(paramString);
    if ((localTextureRegion instanceof TextureAtlas.AtlasRegion))
    {
      TextureAtlas.AtlasRegion localAtlasRegion = (TextureAtlas.AtlasRegion)localTextureRegion;
      if ((localAtlasRegion.rotate) || (localAtlasRegion.packedWidth != localAtlasRegion.originalWidth) || (localAtlasRegion.packedHeight != localAtlasRegion.originalHeight))
        localObject = new TextureAtlas.AtlasSprite(localAtlasRegion);
    }
    if (localObject == null)
      localObject = new Sprite(localTextureRegion);
    add(paramString, localObject, NinePatch.class);
    return localObject;
  }
  catch (GdxRuntimeException localGdxRuntimeException)
  {
  }
  throw new GdxRuntimeException("No NinePatch, TextureRegion, or Texture registered with name: " + paramString);
}
项目:spezi-gdx    文件:Assets.java   
public static Sprite newSprite(AtlasRegion region) {
    if (region.packedWidth == region.originalWidth
            && region.packedHeight == region.originalHeight) {
        if (region.rotate) {
            Sprite sprite = new Sprite(region);
            sprite.setBounds(0, 0, region.getRegionHeight(),
                    region.getRegionWidth());
            sprite.rotate90(true);
            return sprite;
        }
        return new Sprite(region);
    }
    return new AtlasSprite(region);
}