public override void Draw(GameTime gameTime, SpriteBatch spriteBatch) { // Make sure the Texture isn't null if (Texture != null) { // Draw the object using the SpriteRenderer's options spriteBatch.Draw(Texture, GameObject.Transform.Position, Texture.Bounds, Color, GameObject.Transform.Rotation, Pivot, GameObject.Transform.Scale, Effects, SortingLayerUtilities.GetValue(SortingLayer)); } }
public SpriteRenderer(string textureName, Color color) { // Load the texture from the texture name Texture = Utilities.Content.Load <Texture2D>(textureName); Color = color; // Set default values Pivot = new Vector2(Texture.Width / 2f, Texture.Height / 2f); Effects = SpriteEffects.None; SortingLayer = SortingLayerUtilities.DefaultLayer(); }