コード例 #1
0
ファイル: NineSlice.cs プロジェクト: lucas-miranda/Raccoon
        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
ファイル: FrameSet.cs プロジェクト: lucas-miranda/Raccoon
        public FrameSet(AtlasSubTexture subTexture)
        {
            if (subTexture == null)
            {
                throw new System.ArgumentNullException(nameof(subTexture));
            }

            Setup(subTexture.Texture, subTexture.SourceRegion, subTexture.ClippingRegion.Size);
        }
コード例 #3
0
ファイル: Atlas.cs プロジェクト: lucas-miranda/Raccoon
        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
ファイル: FrameSet.cs プロジェクト: lucas-miranda/Raccoon
        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
ファイル: NineSlice.cs プロジェクト: lucas-miranda/Raccoon
 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
ファイル: Atlas.cs プロジェクト: lucas-miranda/Raccoon
 public bool TryRetrieveSubTexture(string name, out AtlasSubTexture atlasSubTexture)
 {
     return(_subTextures.TryGetValue(name.ToLowerInvariant(), out atlasSubTexture));
 }