Nick Gravelyn

So I've been trying to read all I can about the features of XNA and one that I'm just starting to discover is the GameComponent system. I have a small knowledge of what's going on, but I can't seem to find much on how it works in V1.0. I Googled and found a video (http://blogs.msdn.com/xna/archive/2006/08/31/734204.aspx) but that covers back during beta 1, which was the same for most other sites.

Does anyone have any links to sites that talk about GameComponents and how they work Or does anyone have a few minutes to go through them I'm looking for as in depth as possible so I can really see what I can do with them. Thanks in advance.


Re: XNA Framework GameComponents In Depth With V1

Richard Kain

I'm actually interested in this as well. I was able to create my own GameComponent in version 1. The problem was, I wasn't able to do very much with it. I ran into limited application for my GameComponent. It would really be nice to get a tutorial on what kind of functions are best compartmentalized as GameComponents.




Re: XNA Framework GameComponents In Depth With V1

JDPeckham

Let's say you want to make a UserInterface drawable component.

 

public class UserInterface : DrawableComponent{}

 

Make sure you either have your own content manager for this or you pass the Game content manager through the constructor.

 

override the LoadResources() function for loading content

override Initialize for one time initialization (post construction)

override Draw for rendering (drawable component has a GraphicsDevice Property to draw on)

those are the main ones.

 

in your game code, construct your component in the game.Initialize() function prior to adding it to game.Components, and all prior to calling base.Initialize()

 

Hope this helps!