The default effect used by SpriteBatch.
Inheritance: Effect
Example #1
0
        public SpriteBatch(GraphicsDevice graphicsDevice)
        {
            if (graphicsDevice == null) {
                throw new ArgumentException ("graphicsDevice");
            }

            this.graphicsDevice = graphicsDevice;
            spriteEffect = new SpriteEffect (this.graphicsDevice);
            _batcher = new SpriteBatcher ();
        }
Example #2
0
        public SpriteBatch(GraphicsDevice graphicsDevice)
        {
            if (graphicsDevice == null)
            {
                throw new ArgumentException("graphicsDevice");
            }

            this.graphicsDevice = graphicsDevice;
            spriteEffect        = new SpriteEffect(this.graphicsDevice);
            _batcher            = new SpriteBatcher();
        }
Example #3
0
 /// <summary>
 /// Immediately releases the unmanaged resources used by this object.
 /// </summary>
 /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     if (!IsDisposed)
     {
         if (disposing)
         {
             if (_spriteEffect != null)
             {
                 _spriteEffect.Dispose();
                 _spriteEffect = null;
             }
         }
     }
     base.Dispose(disposing);
 }
Example #4
0
        /// <summary>
        /// Constructs a <see cref="SpriteBatch"/>.
        /// </summary>
        /// <param name="graphicsDevice">The <see cref="GraphicsDevice"/>, which will be used for sprite rendering.</param>
        /// <param name="capacity">The initial capacity of the internal array holding batch items (the value will be rounded to the next multiple of 64).</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="graphicsDevice"/> is null.</exception>
        public SpriteBatch(GraphicsDevice graphicsDevice, int capacity)
        {
            if (graphicsDevice == null)
            {
                throw new ArgumentNullException("graphicsDevice", FrameworkResources.ResourceCreationWhenDeviceIsNull);
            }

            this.GraphicsDevice = graphicsDevice;

            _spriteEffect = new SpriteEffect(graphicsDevice);
            _spritePass   = _spriteEffect.CurrentTechnique.Passes[0];

            _batcher = new SpriteBatcher(graphicsDevice, capacity);

            _beginCalled = false;
        }
Example #5
0
 /// <summary>
 /// Creates a new SpriteEffect by cloning parameter settings from an existing instance.
 /// </summary>
 protected SpriteEffect(SpriteEffect cloneSource)
     : base(cloneSource)
 {
     CacheEffectParameters();
 }
Example #6
0
 protected SpriteEffect(SpriteEffect cloneSource)
   : base((Effect) cloneSource)
 {
   this.CacheEffectParameters();
 }
Example #7
0
 /// <summary>
 /// Creates a new SpriteEffect by cloning parameter settings from an existing instance.
 /// </summary>
 protected SpriteEffect(SpriteEffect cloneSource)
     : base(cloneSource)
 {
     CacheEffectParameters();
 }
Example #8
0
 protected SpriteEffect(SpriteEffect cloneSource)
     : base((Effect)cloneSource)
 {
     this.CacheEffectParameters();
 }