Class DrawableGameComponent
A GameComponent that is drawn when its Game is drawn.
public class DrawableGameComponent : GameComponent, IGameComponent, IUpdateable, IDisposable, IDrawable
- Inheritance
-
DrawableGameComponent
- Implements
- Inherited Members
Constructors
DrawableGameComponent(Game)
Create a DrawableGameComponent.
public DrawableGameComponent(Game game)
Parameters
game
GameThe game that this component will belong to.
Properties
DrawOrder
public int DrawOrder { get; set; }
Property Value
GraphicsDevice
Get the GraphicsDevice that this DrawableGameComponent uses for drawing.
public GraphicsDevice GraphicsDevice { get; }
Property Value
Visible
Indicates if Draw(GameTime) will be called.
public bool Visible { get; set; }
Property Value
Methods
Dispose(bool)
Shuts down the component.
protected override void Dispose(bool disposing)
Parameters
disposing
bool
Draw(GameTime)
Draw this component.
public virtual void Draw(GameTime gameTime)
Parameters
gameTime
GameTimeThe time elapsed since the last call to Draw(GameTime).
Initialize()
Initializes the component. Used to load non-graphical resources.
public override void Initialize()
LoadContent()
Load graphical resources needed by this component.
protected virtual void LoadContent()
OnDrawOrderChanged(object, EventArgs)
Called when DrawOrder changed.
protected virtual void OnDrawOrderChanged(object sender, EventArgs args)
Parameters
sender
objectThis DrawableGameComponent.
args
EventArgsArguments to the DrawOrderChanged event.
OnVisibleChanged(object, EventArgs)
Called when Visible changed.
protected virtual void OnVisibleChanged(object sender, EventArgs args)
Parameters
sender
objectThis DrawableGameComponent.
args
EventArgsArguments to the VisibleChanged event.
UnloadContent()
Unload graphical resources needed by this component.
protected virtual void UnloadContent()
Events
DrawOrderChanged
Raised when DrawOrder changed.
public event EventHandler<EventArgs> DrawOrderChanged
Event Type
VisibleChanged
Raised when Visible changed.
public event EventHandler<EventArgs> VisibleChanged