How to use IUpdateable interface in XNA


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. 

Up Next
    Ebook Download
    View all
    Learn
    View all
    Araf Global is a software consultancy company founded in 2016 focusing on cutting edge technologies.