Class ImageControl
A picture: a texture, or a named picture from the view's scope. See Source.
public class ImageControl : UIElement, IUpdateable, IEquatable<IUpdateable>, IDrawable, IIdentifiable<Guid>, IEquatable<IDrawable>, IDisposable
- Inheritance
-
ImageControl
- Implements
- Inherited Members
Constructors
ImageControl(ILogger, View, string)
Creates an image control in view. A null controlId
gives it a generated id.
public ImageControl(ILogger logger, View view, string controlId)
Parameters
Properties
Color
The tint applied to the picture. White, the default, leaves it as it is.
public Color Color { get; set; }
Property Value
Source
A picture by a name the view's Pictures gives meaning to, drawn in place of Texture and SourceRectangle; null or empty for none. Nothing is drawn when the view has no pictures or they do not have it.
public string Source { get; set; }
Property Value
SourceRectangle
Region of Texture to draw, or null for the whole thing.
public Rectangle? SourceRectangle { get; set; }
Property Value
Remarks
Lets one sheet serve many images without slicing it into an atlas first - a character sprite sheet where the cell depends on facing and animation frame, for instance, where the cell is chosen at runtime rather than authored in the view.
Texture
The texture to draw, when Source is empty. A region of it can be chosen with SourceRectangle.
public ITexture Texture { get; set; }
Property Value
Methods
Draw(IGameTime)
Draws the picture at the control's Bounds, unless it is hidden or there is no picture to draw.
public override void Draw(IGameTime gameTime)
Parameters
gameTimeIGameTime