Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8"?>
- <CodeSnippets
- xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
- <CodeSnippet Format="1.0.0">
- <Header>
- <Title>Sprite Batch</Title>
- <Author>John Steel</Author>
- <Description>Inserts the default draw override stuff using the 6th draw overload.</Description>
- <Shortcut>sb-d6</Shortcut>
- </Header>
- <Snippet>
- <Declarations>
- <Literal>
- <ID>sb</ID>
- <ToolTip>The spritebatch variable name.</ToolTip>
- <Default>spritebatch</Default>
- </Literal>
- <Object>
- <ID>texture</ID>
- <Type>Microsoft.Xna.Framework.Graphics.Texture2D</Type>
- <ToolTip>texture: The texture.</ToolTip>
- <Default>texture</Default>
- </Object>
- <Object>
- <ID>position</ID>
- <Type>Microsoft.Xna.Framework.Vector2</Type>
- <ToolTip>position: The location (in screen coordinates) to draw the sprite.</ToolTip>
- <Default>Vector2.Zero</Default>
- </Object>
- <Object>
- <ID>srcRect</ID>
- <Type>Microsoft.Xna.Framework.Rectangle</Type>
- <ToolTip>sourceRectangle: A rectangle that specifies (in texels) the source texels from a texture.
- Use null to draw the entire texture.</ToolTip>
- <Default>null /* Draw whole texture */</Default>
- </Object>
- <Object>
- <ID>colour</ID>
- <Type>Microsoft.Xna.Framework.Color</Type>
- <ToolTip>color: The color to tint a sprite. Use Color.White for full color with no tinting.</ToolTip>
- <Default>Color.White</Default>
- </Object>
- <Object>
- <ID>rotation</ID>
- <Type>System.Single</Type>
- <ToolTip>rotation: Specifies the angle (in radians) to rotate the sprite about its center.</ToolTip>
- <Default>0 /* No rotation */</Default>
- </Object>
- <Object>
- <ID>origin</ID>
- <Type>Microsoft.Xna.Framework.Vector2</Type>
- <ToolTip>origin: The sprite origin; the default is (0,0) which represents the upper-left corner.</ToolTip>
- <Default>Vector2.Zero</Default>
- </Object>
- <Object>
- <ID>scale</ID>
- <Type>System.Single</Type>
- <ToolTip>scale: Scale factor.</ToolTip>
- <Default>1 /* 1 : 1 Scale */</Default>
- </Object>
- <Object>
- <ID>effect</ID>
- <Type>Microsoft.Xna.Framework.Graphics.SpriteEffects</Type>
- <ToolTip>effects: Effects to apply.</ToolTip>
- <Default>SpriteEffects.None</Default>
- </Object>
- <Object>
- <ID>layer</ID>
- <Type>System.Single</Type>
- <ToolTip>layerDepth: The depth of a layer. By default, 0 represents the front layer and 1 represents
- a back layer. Use SpriteSortMode if you want sprites to be sorted during
- drawing.</ToolTip>
- <Default>0</Default>
- </Object>
- </Declarations>
- <Code Language="csharp">
- <![CDATA[public override void Draw(GameTime gameTime)
- {
- $sb$.Begin();
- $sb$.Draw($texture$, $position$, $srcRect$, $colour$, $rotation$, $origin$, $scale$, $effect$, $layer$);
- $sb$.End();
- base.Draw(gameTime);
- }]]>
- </Code>
- </Snippet>
- </CodeSnippet>
- </CodeSnippets>
Advertisement
Add Comment
Please, Sign In to add comment