//-----------------------------------------------------------------------------
// DrawContext.cs
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace UserInterfaceSample.Controls
{
///
/// DrawContext is a collection of rendering data to pass into Control.Draw().
/// By passing this data into each Draw call, we controls can access necessary
/// data when they need it, without introducing dependencies on top-level object
/// like ScreenManager.
///
public struct DrawContext
{
///
/// The XNA GraphicsDevice
///
public GraphicsDevice Device;
///
/// GameTime passed into Game.Draw()
///
public GameTime GameTime;
///
/// Shared SpriteBatch for use by any control that wants to draw with it.
/// Begin() is called on this batch before drawing controls, and End() is
/// called after drawing controls, so that multiple controls can have
/// their rendering batched together.
///
public SpriteBatch SpriteBatch;
///
/// A single-pixel white texture, useful for drawing boxes and lines within a SpriteBatch.
///
public Texture2D BlankTexture;
///
/// Positional offset to draw at. Note that this is a simple positional offset rather
/// than a full transform, so this API doesn't easily support full heirarchical transforms.
///
/// A control's position will already be added to this vector when Control.Draw() is called.
///
public Vector2 DrawOffset;
}
}