public class GameComponent extends java.lang.Object implements IGameComponent, IUpdateable, System.IDisposable
Modifier and Type | Field and Description |
---|---|
System.Event<System.EventArgs> |
Disposed
Raised when the GameComponent is disposed.
|
System.Event<System.EventArgs> |
EnabledChanged
Raised when the Enabled property changes.
|
System.Event<System.EventArgs> |
UpdateOrderChanged
Raised when the UpdateOrder property changes.
|
Constructor and Description |
---|
GameComponent(Game game)
Initializes a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
void |
Dispose()
Immediately releases the unmanaged resources used by this object.
|
protected void |
Dispose(boolean disposing)
Releases the unmanaged resources used by the GameComponent and optionally releases the managed resources.
|
boolean |
getEnabled()
Indicates whether GameComponent.Update should be called when Game.Update is called.
|
Game |
getGame()
Gets the Game associated with this GameComponent.
|
int |
getUpdateOrder()
Indicates the order in which the GameComponent should be updated relative to other GameComponent instances.
|
void |
Initialize() |
protected void |
OnEnabledChanged(java.lang.Object sender,
System.EventArgs e)
Called when the Enabled property changes.
|
protected void |
OnUpdateOrderChanged(java.lang.Object sender,
System.EventArgs e)
Called when the UpdateOrder property changes.
|
void |
setEnabled(boolean value) |
void |
setUpdateOrder(int value) |
void |
Update(GameTime gameTime)
Called when the GameComponent needs to be updated.
|
public final System.Event<System.EventArgs> Disposed
public final System.Event<System.EventArgs> EnabledChanged
public final System.Event<System.EventArgs> UpdateOrderChanged
public GameComponent(Game game)
game
- Game that the game component should be attached to.public boolean getEnabled()
getEnabled
in interface IUpdateable
public void setEnabled(boolean value)
public Game getGame()
public int getUpdateOrder()
getUpdateOrder
in interface IUpdateable
public void setUpdateOrder(int value)
public void Dispose()
Dispose
in interface System.IDisposable
protected void Dispose(boolean disposing)
disposing
- true to release both managed and unmanaged resources; false to release only unmanaged resources.public void Initialize()
Initialize
in interface IGameComponent
protected void OnEnabledChanged(java.lang.Object sender, System.EventArgs e)
sender
- The GameComponent.e
- Arguments to the EnabledChanged event.protected void OnUpdateOrderChanged(java.lang.Object sender, System.EventArgs e)
sender
- The GameComponent.e
- Arguments to the UpdateOrderChanged event.public void Update(GameTime gameTime)
Update
in interface IUpdateable
gameTime
- Time elapsed since the last call to Update