示例#1
0
        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);
            }
        }
示例#2
0
        public FrameSet(AtlasSubTexture subTexture)
        {
            if (subTexture == null)
            {
                throw new System.ArgumentNullException(nameof(subTexture));
            }

            Setup(subTexture.Texture, subTexture.SourceRegion, subTexture.ClippingRegion.Size);
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
 public NineSlice(Rectangle centerSlice, AtlasSubTexture subTexture) : this() {
     Prepare(centerSlice, subTexture);
 }
示例#6
0
 public Animation(AtlasSubTexture subTexture, Size frameSize)
 {
     Texture        = subTexture.Texture;
     SourceRegion   = subTexture.SourceRegion;
     ClippingRegion = new Rectangle(frameSize);
 }
示例#7
0
 public bool TryRetrieveSubTexture(string name, out AtlasSubTexture atlasSubTexture)
 {
     return(_subTextures.TryGetValue(name.ToLowerInvariant(), out atlasSubTexture));
 }