Table of Contents

Class DrawableGameComponent

Namespace
Microsoft.Xna.Framework
Assembly
MonoGame.Framework.dll

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)

public DrawableGameComponent(Game game)

Parameters

game Game

The game that this component will belong to.

Properties

DrawOrder

The draw order of this IDrawable relative to other IDrawable instances.

public int DrawOrder { get; set; }

Property Value

int

GraphicsDevice

Get the GraphicsDevice that this DrawableGameComponent uses for drawing.

public GraphicsDevice GraphicsDevice { get; }

Property Value

GraphicsDevice

Visible

Indicates if Draw(GameTime) will be called.

public bool Visible { get; set; }

Property Value

bool

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 GameTime

The 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 object

This DrawableGameComponent.

args EventArgs

Arguments to the DrawOrderChanged event.

OnVisibleChanged(object, EventArgs)

Called when Visible changed.

protected virtual void OnVisibleChanged(object sender, EventArgs args)

Parameters

sender object

This DrawableGameComponent.

args EventArgs

Arguments 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

EventHandler<EventArgs>

VisibleChanged

Raised when Visible changed.

public event EventHandler<EventArgs> VisibleChanged

Event Type

EventHandler<EventArgs>