Game component causes game to freeze
- by ChocoMan
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