예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        public virtual void Draw(DrawContext context)
        {
            Vector2 origin = context.DrawOffset;

            for (int i = 0; i < ChildCount; i++)
            {
                Control child = children[i];
                if (child.Visible)
                {
                    context.DrawOffset = origin + child.Position;
                    child.Draw(context);
                }
            }
        }
예제 #2
0
 // Call this method once per frame on the root of your control heirarchy to draw all the controls.
 // See ControlScreen for an example.
 public static void BatchDraw(Control control, GraphicsDevice device, SpriteBatch spriteBatch, Vector2 offset, GameTime gameTime)
 {
     if (control != null && control.Visible)
     {
         spriteBatch.Begin();
         control.Draw(new DrawContext
         {
             Device      = device,
             SpriteBatch = spriteBatch,
             DrawOffset  = offset + control.Position,
             GameTime    = gameTime
         });
         spriteBatch.End();
     }
 }
예제 #3
0
 // Call this method once per frame on the root of your control heirarchy to draw all the controls.
 // See ControlScreen for an example.
 public static void BatchDraw(Control control, GraphicsDevice device, SpriteBatch spriteBatch, Vector2 offset, GameTime gameTime)
 {
     if (control != null && control.Visible)
     {
         spriteBatch.Begin();
         control.Draw(new DrawContext
         {
             Device = device,
             SpriteBatch = spriteBatch,
             DrawOffset = offset + control.Position,
             GameTime = gameTime
         });
         spriteBatch.End();
     }
 }