/// <summary>
 /// Updates the visible area rectangle of the camera
 /// </summary>
 public void UpdateVisibleArea(ScreenResolutionService resolutionService)
 {
     visibleArea = new RectangleF2(position.X, position.Y, resolutionService.StartTextureWidth, resolutionService.StartTextureHeight);
 }
        public override void Initialize()
        {
            camera = (ICameraService)ScreenManager.Instance.Services.GetService(typeof(ICameraService));
            collisionSpaceRectangle = new RectangleF2(camera.VisibleArea.X,
                camera.VisibleArea.Y, camera.VisibleArea.Width + (bufferBins * binWidth), camera.VisibleArea.Height + (bufferBins * binHeight));
            if (collisionSpaceRectangle.Width > camera.VisibleArea.Width &&
               collisionSpaceRectangle.Height > camera.VisibleArea.Height)
            {
                offsetVector.X = (collisionSpaceRectangle.Width - camera.VisibleArea.Width)/2;
                offsetVector.Y = (collisionSpaceRectangle.Height - camera.VisibleArea.Height)/2;
            }

            gridWidth = (int)(collisionSpaceRectangle.Width / binWidth);
            gridHeight = (int)(collisionSpaceRectangle.Height / binHeight);
            objectCollisionGrid = new CollisionObjectBin[gridWidth, gridHeight];
            for (int y = 0; y < gridHeight; y++)
            {
                for (int x = 0; x < gridWidth; x++)
                {
                    objectCollisionGrid[x, y] = new CollisionObjectBin(this, x, y);
                }
            }
            base.Initialize();
        }
        /// <summary>
        /// Initializes the internal state of the camera
        /// </summary>
        public override void Initialize()
        {
            position = Vector2.Zero;
            viewMatrix = Matrix.Identity;

            inputManager = (IInputManagerService)this.Game.Services.GetService(typeof(IInputManagerService));
            resolutionService = (IScreenResolutionService)this.Game.Services.GetService(typeof(IScreenResolutionService));
            if(this.visibleArea == null)
                this.visibleArea = new RectangleF2();

            base.Initialize();
        }