Difference between revisions of "XNA Game Components"
esse quam videri
m (Text replacement - "</csharp>" to "</syntaxhighlight>") |
m (Text replacement - "syntaxhighlight lang="csharp" line="1" " to "syntaxhighlight lang="csharp"") |
||
Line 5: | Line 5: | ||
Here is a class classed Sprite that was created as an XNA Game Component. I have not added and methods to this class yet. Notice that when you create a game component it already has some of the [[Template:XNA structure]] | Here is a class classed Sprite that was created as an XNA Game Component. I have not added and methods to this class yet. Notice that when you create a game component it already has some of the [[Template:XNA structure]] | ||
− | <syntaxhighlight lang="csharp | + | <syntaxhighlight lang="csharp"> |
namespace WindowsGameDemo | namespace WindowsGameDemo | ||
{ | { |
Latest revision as of 03:22, 9 February 2016
Most Game components will inherit the structure of the Game Class.
Here is a class classed Sprite that was created as an XNA Game Component. I have not added and methods to this class yet. Notice that when you create a game component it already has some of the Template:XNA structure
namespace WindowsGameDemo
{
/// <summary>
/// This is a game component that implements IUpdateable.
/// </summary>
public class Sprite : Microsoft.Xna.Framework.GameComponent
{
public Sprite(Game game)
: base(game)
{
// TODO: Construct any child components here
}
/// <summary>
/// Allows the game component to perform any initialization it needs to before starting
/// to run. This is where it can query for any required services and load content.
/// </summary>
public override void Initialize()
{
// TODO: Add your initialization code here
base.Initialize();
}
/// <summary>
/// Allows the game component to update itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
public override void Update(GameTime gameTime)
{
// TODO: Add your update code here
base.Update(gameTime);
}
}
}