Microsoft.Xna.Framework.Graphics.SpriteBatch.Draw C# (CSharp) Method

Draw() public method

Submit a sprite for drawing in the current batch.
public Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, System.Color color ) : void
texture Microsoft.Xna.Framework.Graphics.Texture2D A texture.
destinationRectangle Rectangle The drawing bounds on screen.
color System.Color A color mask.
return void
        public void Draw(Texture2D texture, Rectangle destinationRectangle, Color color)
		{
            Draw(texture, destinationRectangle, null, color);
		}

Same methods

SpriteBatch::Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, System.Color color ) : void
SpriteBatch::Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, Rectangle destinationRectangle, Rectangle sourceRectangle, System.Color color, float rotation, System.Vector2 origin, SpriteEffects effects, float layerDepth ) : void
SpriteBatch::Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, System.Color color ) : void
SpriteBatch::Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, Rectangle sourceRectangle, System.Color color ) : void
SpriteBatch::Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, Rectangle sourceRectangle, System.Color color, float rotation, System.Vector2 origin, System.Vector2 scale, SpriteEffects effects, float layerDepth ) : void
SpriteBatch::Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position, Rectangle sourceRectangle, System.Color color, float rotation, System.Vector2 origin, float scale, SpriteEffects effects, float layerDepth ) : void
SpriteBatch::Draw ( Microsoft.Xna.Framework.Graphics.Texture2D texture, System.Vector2 position = null, Rectangle destinationRectangle = null, Rectangle sourceRectangle = null, System.Vector2 origin = null, float rotation = 0f, System.Vector2 scale = null, System.Color color = null, SpriteEffects effects = SpriteEffects.None, float layerDepth = 0f ) : void

Usage Example

Example #1
0
        public override void Draw(Microsoft.Xna.Framework.Graphics.SpriteBatch sb)
        {
            sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.None, _rasterizerScissorsState);

            sb.Draw(frameText, new Rectangle(X, Y, width, height), Color.White);

            //if (new Rectangle(X, Y, width, height).Contains((int)GUI.InputManager.MousePosition.X, (int)GUI.InputManager.MousePosition.Y))
            //    if(GUI.InputManager.MouseManager.State.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            //        sb.Draw(backText, ClientArea, Color.Gray);
            //    else
            //        sb.Draw(backText, ClientArea, Color.LightGray);
            //else

            sb.Draw(backText, ClientArea, topColor);
            topColor = Color.White;

            Rectangle oldsc = sb.GraphicsDevice.ScissorRectangle;

            sb.GraphicsDevice.ScissorRectangle = ClientArea;

            sb.DrawString(Parent.Font, drawText, new Vector2(ClientArea.X + 3, ClientArea.Y + 3 - text_y_scroll), Color.Black); //, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
            //sb.DrawString(font, drawString, new Vector2(destination.X, destination.Y - yoffset), color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0);

            sb.GraphicsDevice.ScissorRectangle = oldsc;

            sb.End();
        }
All Usage Examples Of Microsoft.Xna.Framework.Graphics.SpriteBatch::Draw