コード例 #1
0
ファイル: SpriteManager.cs プロジェクト: mrwillbarnz/ualbion
        public SpriteLease Borrow(SpriteKey key, int length, object caller)
        {
            lock (_syncRoot)
            {
                if (!_sprites.ContainsKey(key))
                {
                    _sprites[key] = new MultiSprite(key);
                }

                var entry = _sprites[key];
                return(entry.Grow(length, caller));
            }
        }
コード例 #2
0
        public SpriteLease Borrow(SpriteKey key, int length, object caller)
        {
            if (length <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(length));
            }
            lock (_syncRoot)
            {
                if (!_sprites.ContainsKey(key))
                {
                    _sprites[key] = new MultiSprite(key);
                }

                var entry = _sprites[key];
                return(entry.Grow(length, caller));
            }
        }
コード例 #3
0
        public SpriteLease Borrow(SpriteKey key, int length, object caller)
        {
            if (length <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(length));
            }
            lock (_syncRoot)
            {
                if (!_sprites.TryGetValue(key, out var entry))
                {
                    entry = new MultiSprite(key);
                    Resolve <IEngine>()?.RegisterRenderable(entry);
                    _sprites[key] = entry;
                }

                return(entry.Grow(length, caller));
            }
        }
コード例 #4
0
 // Should only be created by MultiSprite
 internal SpriteLease(MultiSprite sprite, int @from, int to)
 {
     _sprite = sprite;
     From    = @from;
     To      = to;
 }
コード例 #5
0
 public WeakSpriteReference(MultiSprite multiSprite, SpriteLease lease, int offset)
 {
     _multiSprite = multiSprite;
     _lease       = new WeakReference <SpriteLease>(lease);
     _offset      = offset;
 }
コード例 #6
0
 public SpriteShaderKey(MultiSprite sprite) : this(
         sprite.Key.Texture.ArrayLayers > 1,
         !sprite.Key.Flags.HasFlag(SpriteKeyFlags.NoDepthTest),
         sprite.Key.Texture is EightBitTexture)
 {
 }