Class GameComponent
An object that can be attached to a Game and have its Update(GameTime) method called when Update(GameTime) is called.
public class GameComponent : IGameComponent, IUpdateable, IDisposable
- Inheritance
-
GameComponent
- Implements
- Derived
- Inherited Members
Constructors
GameComponent(Game)
Create a GameComponent.
public GameComponent(Game game)
Parameters
game
GameThe game that this component will belong to.
Properties
Enabled
Indicates if Update(GameTime) will be called.
public bool Enabled { get; set; }
Property Value
Game
The Game that owns this GameComponent.
public Game Game { get; }
Property Value
UpdateOrder
The update order of this GameComponent relative to other GameComponent instances.
public int UpdateOrder { get; set; }
Property Value
Methods
Dispose()
Shuts down the component.
public void Dispose()
Dispose(bool)
Shuts down the component.
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
~GameComponent()
protected ~GameComponent()
Initialize()
Initializes the component. Used to load non-graphical resources.
public virtual void Initialize()
OnEnabledChanged(object, EventArgs)
Called when Enabled changed. Raises the EnabledChanged event.
protected virtual void OnEnabledChanged(object sender, EventArgs args)
Parameters
sender
objectThis GameComponent.
args
EventArgsArguments to the EnabledChanged event.
OnUpdateOrderChanged(object, EventArgs)
Called when UpdateOrder changed. Raises the UpdateOrderChanged event.
protected virtual void OnUpdateOrderChanged(object sender, EventArgs args)
Parameters
sender
objectThis GameComponent.
args
EventArgsArguments to the UpdateOrderChanged event.
Update(GameTime)
Update the component.
public virtual void Update(GameTime gameTime)
Parameters
Events
EnabledChanged
Raised when Enabled changed.
public event EventHandler<EventArgs> EnabledChanged
Event Type
UpdateOrderChanged
Raised when UpdateOrder changed.
public event EventHandler<EventArgs> UpdateOrderChanged