Reader Level:
ARTICLE

How to use IUpdateable interface in XNA

On August 09, 2010 Articles | XNA with C#
In this mini article I will be talking about How to use IUpdateable interface.
  • 0
  • 0
  • 6294

In this mini article I will be talking about How to use IUpdateable interface.

You can implement IUpdateable in Game1 as shown below:

1.gif
 
And after that it will add some functions and events:

#region IUpdateable Members

public bool Enabled
{
  get { throw new NotImplementedException(); }
}

public event EventHandler<EventArgs> EnabledChanged;

public new void Update(GameTime gameTime)
{
  throw new NotImplementedException();
}

public int UpdateOrder
{
  get { throw new NotImplementedException(); }
}

public event EventHandler<EventArgs> UpdateOrderChanged; 
#endregion

If you implement this in your Game1 code, it will give errors telling you theres one more Update function so remove one of them if you want to test it.

This interface looks pretty much IDrawable so implementing this in a Game1 object will not help you,so implement this interface on a GameComponent. 

Ibrahim Ersoy

Ibrahim Ersoy lives in Turkey, Istanbul. He helps running and managing C# Corner. He is a Software Consultant (Sharepoint) and MindCracker MVP. He writes about cutting-edge Microsoft Technologies...

Personal Blog: http://www.iersoy.com
  • 48rank
  • 1M readers
  • 2times
COMMENT USING

Trending up