Correction: Engine Constructor

The Engine Constructor used in the XNA Game Engine Tutorial Series 2.0 so far is incorrect. It should actually be as follows:

public Engine(GraphicsDeviceManager Graphics)
{
    services = new ServiceContainer();
    services.AddService(typeof(IGraphicsDeviceService), Graphics);
    services.AddService(typeof(IGraphicsDeviceManager), Graphics);

    this.graphicsDevice = Graphics.GraphicsDevice;
    content = new IEContentManager(Services);
    spriteBatch = new SpriteBatch(GraphicsDevice);
    this.graphicsDevice = GraphicsDevice;
}

In the future, the tutorials and sample games will reflect this change.

5 Responses to “Correction: Engine Constructor” »

  1. Pingback by Innovation Engine Roadmap 2009-2010 | Innovative Games — January 5, 2010 @ 9:04 pm

    [...] Correction: Engine Constructor [...]

  2. Comment by Phil — January 6, 2010 @ 11:03 am

    Having read through this and the code a couple of times I don’t understand why you need the last line of the constructor, which sets the graphics device for a second time. I would be extremely grateful if someone could explain why this is necessary.

    Thanks in advance,

    Phil

  3. Comment by Alex — February 20, 2010 @ 12:50 pm

    Hi, please can you explain the change

    content = new ContentManager(Services);

    to

    content = new IEContentManager(Services);

    I get
    Error 1 The type or namespace name ‘IEContentManager’ could not be found (are you missing a using directive or an assembly reference?)

    also, above i assume you do not need
    this.graphicsDevice = GraphicsDevice;

    Thank you! great work!

  4. Comment by Alex — February 20, 2010 @ 12:55 pm

    ignore me please, im so n00b hehe

  5. Comment by Carter — December 31, 2010 @ 12:16 am

    Yeah, I’m a bit confused by this too… Any possibility for clarification? I’d be grateful as well.

RSS feed for comments on this post. TrackBack URI

Leave a comment