Exemplo n.º 1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            if (Keyboard.GetState().IsKeyDown(Keys.F1))
            {
                rays.lightTexture = Content.Load <Texture2D>("Textures/flare");
            }
            if (Keyboard.GetState().IsKeyDown(Keys.F2))
            {
                rays.lightTexture = Content.Load <Texture2D>("Textures/flare2");
            }
            if (Keyboard.GetState().IsKeyDown(Keys.F3))
            {
                rays.lightTexture = Content.Load <Texture2D>("Textures/flare3");
            }
            if (Keyboard.GetState().IsKeyDown(Keys.F4))
            {
                rays.lightTexture = Content.Load <Texture2D>("Textures/flare4");
            }

            if (Keyboard.GetState().IsKeyDown(Keys.F12))
            {
                ppm.SaveTexture((Texture2D)rays.lightTexture, "c:\\temp\\godray.jpeg");
            }



            if (Keyboard.GetState().IsKeyDown(Keys.W))
            {
                rays.lightSource = new Vector2(rays.lightSource.X, rays.lightSource.Y - .01f);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.S))
            {
                rays.lightSource = new Vector2(rays.lightSource.X, rays.lightSource.Y + .01f);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.A))
            {
                rays.lightSource = new Vector2(rays.lightSource.X - .01f, rays.lightSource.Y);
            }
            if (Keyboard.GetState().IsKeyDown(Keys.D))
            {
                rays.lightSource = new Vector2(rays.lightSource.X + .01f, rays.lightSource.Y);
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Q))
            {
                rays.Exposure += .01f;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.Z))
            {
                rays.Exposure -= .01f;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.E))
            {
                rays.LightSourceSize += .01f;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.C))
            {
                rays.LightSourceSize -= .01f;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.R))
            {
                rays.Density += .01f;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.V))
            {
                rays.Density -= .01f;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.T))
            {
                rays.Decay += .01f;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.B))
            {
                rays.Decay -= .01f;
            }

            if (Keyboard.GetState().IsKeyDown(Keys.Y))
            {
                rays.Weight += .01f;
            }
            if (Keyboard.GetState().IsKeyDown(Keys.N))
            {
                rays.Weight -= .01f;
            }

            base.Update(gameTime);
        }