Recently, I have been learning some article about using xNa framework to develop games. I have dreamed to create a wonderful game long ago. but at that time, I don't know how to do and where to start, that's really a big deal for me. I knew xNa about one year ago, I just tried some start kiters and still didn't know how to deal this great deal.
Have holidays at home, nothing to do, why not have a try. What's more there're really allocated resources about xNa, so I think it's a perfect time to start.
To begin with xNa, I read some introduction articles through net, tried some simple examples. during practice, I found there's something misleading in the Windows game template.
After you created a new window game (2.0) project, in the game1.cs file, the code for initialize () method is:
Protected override void initialize ()
{
// Todo: add your initialization logic here
Base. initialize ();
}
When coding, I just follow the todo tip, write my initialization code before base. initialize (), then I got null exception in the loadcontent () and draw () method. it seems the two method are called before initialize (), at least the first time they are called. after I moved base. initialize () to the very ining of the method initialize (), everything goes well. in my opinion, maybe the first time the two methods are called to display something on the screen, and initialize () was called just before the game logic really start.
Conclusion:
Write your initializing code after base. initialize ()!