Example #1
0
        /// <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()
        {
            // TODO: Add your initialization logic here

            this.camera = new Camera(this, new Vector3(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2, 1000),
                                    new Vector3(1, 0, 0),
                                    new Vector3(0, 1, 0),
                                    new Vector3(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2, -500));
            this.Components.Add(this.camera);
            this.Services.AddService(typeof(Camera), this.camera);

            this.fps = new FPS(this);
            this.Components.Add(this.fps);

            this.kinect = new Kinect(this);
            this.Components.Add(this.kinect);
            //this.Services.AddService(typeof(Kinect), this.kinect);

            effect = new BasicEffect(GraphicsDevice);

            //for sphere
            //create new distortion object
            distortion = new Distortion(Vector3.Backward, 1, 1, distortionShift, 3, 1.33f);
            View = Matrix.CreateLookAt(new Vector3(0, 0, 2), Vector3.Zero, Vector3.Up);
            Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 16.0f / 9.0f, 1, 500);

            screenCenter = new Vector2(graphics.PreferredBackBufferWidth / 2, graphics.PreferredBackBufferHeight / 2);

            base.Initialize();
        }