GameComponent Constructor

Initializes a new instance of this class.

Syntax

'Declaration
Public Sub New ( _
         game As Game _
)
public GameComponent (
         Game game
)
public:
GameComponent(
         Game game
)

Parameters

  • game
    Type: Game
    Game that the game component should be attached to.

Remarks

Game components provide a modular way of adding functionality to a game. You create a game component by deriving the new component either from the GameComponent class, or, if the component loads and draws graphics content, from the DrawableGameComponent class. You then add game logic and rendering code to the game component by overriding GameComponent.Update, DrawableGameComponent.Draw and GameComponent.Initialize. A game component is registered with a game by passing the component to Game.Components.Add. A registered component will have its initialize, update, and draw methods called from the Game.Initialize, Game.Update, and Game.Draw methods, respectively.

Requirements

Namespace: Microsoft.Xna.Framework

Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

See Also

Reference

GameComponent Class
GameComponent Members
Microsoft.Xna.Framework Namespace

Platforms

Windows Phone