Sign in to follow this  
Uphoreum

[.net] [XNA] Base Class

Recommended Posts

Do I need to call the base classes overriden methods? Like, base.Initialize(), base.Draw(), base.Update()? Or is there nothing useful in those?

Share this post


Link to post
Share on other sites
When setting up a new "Windows Game" project, the template main game class they make for you that derives from Microsoft.Xna.Framework.Game does explicitly call base.Initialize(), base.Draw(), base.Update(), etc. for its respective overridden functions so I'd assume that's necessary. Not sure what exactly they do though.

Share this post


Link to post
Share on other sites
Oh, okay. I'll just do it, it can't hurt.

As a side question here, I forgot when Initialize is called, and what you should do in there. Should I set variable values in there?

Share this post


Link to post
Share on other sites
The XNA documentation suggests "Override [Initialize()] to query for any required services and load any non-graphics resources".

The docs also list the effects of calling base.Intialize/Draw/Update/etc() under the "Remarks" category of the respective functions of Microsoft.Xna.Framework.Game if you're interested in seeing what exactly they do. base.Initialize() will apparently "enumerate through any components and call their Initialize methods."

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this