Game component causes game to freeze

Posted by ChocoMan on Game Development See other posts from Game Development or by ChocoMan
Published on 2012-09-09T13:04:20Z Indexed on 2012/09/09 15:50 UTC
Read the original article Hit count: 380

Filed under:
|

I'm trying to add my camera component to Game1 class' constructor like so:

Camera camera; // from  class Camera : GameComponent
....

public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        this.graphics.PreferredBackBufferWidth = screenWidth;
        this.graphics.PreferredBackBufferHeight = screenHieght;
        this.graphics.IsFullScreen = true;
        Content.RootDirectory = "Content";

        camera = new Camera(this);
        Components.Add(camera);
    }

From the just adding the last two lines, when I run the game, the screen freezes then gives me this message:

An unhandled exception of type 'System.ComponentModel.Win32Exception' occurred in System.Drawing.dll

Additional information: The operation completed successfully

© Game Development or respective owner

Related posts about XNA

Related posts about component-based