Exemplo n.º 1
0
 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));
     }
 }
Exemplo n.º 2
0
        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();
        }