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); }
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); }