public void Prepare(Rectangle centerSlice, AtlasSubTexture subTexture) { if (subTexture == null) { throw new System.ArgumentNullException(nameof(subTexture)); } Texture = subTexture.Texture; bool wasUsingCustomSize = _isUsingCustomSize; Size previousSize = Size; _isUsingCustomSize = false; Prepare( centerSlice, subTexture.SourceRegion, subTexture.ClippingRegion, subTexture.OriginalFrame ); Load(); _baseSize = Size; if (wasUsingCustomSize) { Setup(previousSize); } }
public FrameSet(AtlasSubTexture subTexture) { if (subTexture == null) { throw new System.ArgumentNullException(nameof(subTexture)); } Setup(subTexture.Texture, subTexture.SourceRegion, subTexture.ClippingRegion.Size); }
public AtlasAnimation RetrieveAnimation(string name) { AtlasSubTexture subTexture = RetrieveSubTexture(name); if (!(subTexture is AtlasAnimation animation)) { throw new AtlasMismatchSubTextureTypeException(expectedType: typeof(AtlasAnimation), foundType: subTexture.GetType()); } return(animation); }
public FrameSet(AtlasSubTexture subTexture, Size frameSize, int frameCount) { if (subTexture == null) { throw new System.ArgumentNullException(nameof(subTexture)); } else if (frameCount < 0) { throw new System.ArgumentException("Frame count can't be negative.", nameof(frameCount)); } Setup(subTexture.Texture, subTexture.SourceRegion, frameSize, frameCount); }
public NineSlice(Rectangle centerSlice, AtlasSubTexture subTexture) : this() { Prepare(centerSlice, subTexture); }
public Animation(AtlasSubTexture subTexture, Size frameSize) { Texture = subTexture.Texture; SourceRegion = subTexture.SourceRegion; ClippingRegion = new Rectangle(frameSize); }
public bool TryRetrieveSubTexture(string name, out AtlasSubTexture atlasSubTexture) { return(_subTextures.TryGetValue(name.ToLowerInvariant(), out atlasSubTexture)); }