Пример #1
0
        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)
 {
 }