예제 #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()
        {
            //Dummy chunk for testing
            c = new Chunk();

            //Camera Target block (Covers Camera.LookAt coordinates)
            cameraTarget.Color = new Color(1.0f, 0.0f, 0.0f);

            //Set up some stuff for graphics
            aspectRatio = GraphicsDevice.Viewport.AspectRatio;
            cubeEffect  = new BasicEffect(GraphicsDevice);
            graphics.SynchronizeWithVerticalRetrace = false;    //Turns off VSync
            this.IsFixedTimeStep = true;                        //Make sure it's fixed timestep.
            //this.TargetElapsedTime = new TimeSpan(6666);      //Sets the fixed timestep
            graphics.ApplyChanges();                            //Actually sticks the above changes

            camera = new ArcBallCamera(aspectRatio, new Vector3(0.0f, 0.0f, 0f));
            //camera.MoveCameraRight(0);
            //camera.MoveCameraForward(0);

            //Set up the mouse
            Mouse.SetPosition(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);
            originalMouseState = Mouse.GetState();

            base.Initialize();
        }
예제 #2
0
파일: Game1.cs 프로젝트: mrbaggins/Box
        /// <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()
        {
            //Dummy chunk for testing
            c = new Chunk();

            //Camera Target block (Covers Camera.LookAt coordinates)
            cameraTarget.Color = new Color(1.0f, 0.0f, 0.0f);

            //Set up some stuff for graphics
            aspectRatio = GraphicsDevice.Viewport.AspectRatio;
            cubeEffect = new BasicEffect(GraphicsDevice);
            graphics.SynchronizeWithVerticalRetrace = false;    //Turns off VSync
            this.IsFixedTimeStep = true;                        //Make sure it's fixed timestep.
            //this.TargetElapsedTime = new TimeSpan(6666);      //Sets the fixed timestep
            graphics.ApplyChanges();                            //Actually sticks the above changes

            camera = new ArcBallCamera(aspectRatio, new Vector3(0.0f, 0.0f, 0f));
            //camera.MoveCameraRight(0);
            //camera.MoveCameraForward(0);

            //Set up the mouse
            Mouse.SetPosition(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);
            originalMouseState = Mouse.GetState();

            base.Initialize();
        }