/// <summary> 
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Graphics.PreferredBackBufferWidth = 1280;
            Graphics.PreferredBackBufferHeight = 720;
            Graphics.ApplyChanges();
            
            Components.Add(new FrameRateCounter(this, "Content\\debugfont", 1f));
            Components.Add(new GameObjectInfoDisplay(this, 5, "Content\\debugfont", new Vector2(0f, 25f)));

            ComponentFactory componentFactory = new ComponentFactory();
            TiledGameObjectFactory gameObjectFactory = new TiledGameObjectFactory(this.Content);
            gameObjectFactory.PathToXML = "EntityDefinitions\\entity.xml";
            
            inputHandler = new InputHandler(false);
            playerManager = new PlayerManager();

            particleManager = new ParticleManager(Content, "ParticleEffects\\", "Textures\\");

            PhysicsManager physicsManager = new PhysicsManager();
            particleRenderer = new SpriteBatchRenderer();
            particleRenderer.GraphicsDeviceService = Graphics;

            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            renderer = new Renderer(Graphics, spriteBatch);
            renderer.SetInternalResolution(1280, 720);
            renderer.SetScreenResolution(1280, 720, false);

            GameServiceManager.AddService(typeof(IGameObjectFactory), gameObjectFactory);
            GameServiceManager.AddService(typeof(IComponentFactory), componentFactory);
            GameServiceManager.AddService(typeof(RenderableFactory), new RenderableFactory(this.Content));
            GameServiceManager.AddService(typeof(IInputHandler), inputHandler);
            GameServiceManager.AddService(typeof(PlayerManager), playerManager);
            GameServiceManager.AddService(typeof(IScoreManager), new ScoreManager());
            GameServiceManager.AddService(typeof(IGameObjectManager), new GameObjectManager());
            GameServiceManager.AddService(typeof(IPhysicsManager), physicsManager);
            GameServiceManager.AddService(typeof(IBehaviorFactory), new BehaviorFactory());
            GameServiceManager.AddService(typeof(IActionFactory), new ActionFactory());
            GameServiceManager.AddService(typeof(IActionManager), new ActionManager());
            GameServiceManager.AddService(typeof(ILevelLogicManager), new LevelLogicManager(this.Content));
            GameServiceManager.AddService(typeof(IRandomGenerator), new RandomGenerator());
            GameServiceManager.AddService(typeof(IParticleManager), particleManager);
            GameServiceManager.AddService(typeof(IRenderer), renderer);

            debugView = new DebugViewXNA(GameServiceManager.GetService<IPhysicsManager>().PhysicsWorld);

            //Initialize the GameServices
            GameServiceManager.Initialize();
            
            CameraController.Initialize(this);
            CameraController.MoveCamera(new Vector2(GraphicsDevice.Viewport.Width / 2f, GraphicsDevice.Viewport.Height / 2f));
            
            base.Initialize();
        }
 public override void Initialize()
 {
     factory = (TiledGameObjectFactory) GameServiceManager.GetService(typeof(IGameObjectFactory));
 }