Ejemplo n.º 1
0
        /// <summary>
        /// Main logic update function. Is called once per frame. Use this for all program logic and user inputs
        /// </summary>
        /// <param name="gameTime">Can use this to compute the delta between frames</param>
        /// <param name="isActive">The window status. If this is not the active window we shouldn't do anything</param>
        public void Update(GameTime gameTime, bool isActive)
        {
            if (!isActive)
            {
                return;
            }

            //Upd
            Input.Update(gameTime, Camera);

            //VolumeTexture.RotationMatrix = testEntity.WorldTransform.InverseWorld;
            //VolumeTexture.Scale = testEntity.WorldTransform.Scale;

            //Make the lights move up and down
            //for (var i = 2; i < PointLights.Count; i++)
            //{
            //    PointLight point = PointLights[i];
            //    point.Position = new Vector3(point.Position.X, point.Position.Y, (float)(Math.Sin(gameTime.TotalGameTime.TotalSeconds * 0.8f + i) * 10 - 13));
            //}

            //KeyInputs for specific tasks


            //If we are currently typing stuff into the console we should ignore the following keyboard inputs
            if (DebugScreen.ConsoleOpen)
            {
                return;
            }

            //Starts the "editor mode" where we can manipulate objects
            if (Input.WasKeyPressed(Keys.Space))
            {
                GameSettings.e_enableeditor = !GameSettings.e_enableeditor;
            }



            //Spawns a new light on the ground
            if (Input.keyboardState.IsKeyDown(Keys.L))
            {
                AddPointLight(position: new Vector3(FastRand.NextSingle() * 250 - 125, FastRand.NextSingle() * 50 - 25, FastRand.NextSingle() * 30 - 19),
                              radius: 20,
                              color: FastRand.NextColor(),
                              intensity: 40,
                              castShadows: false,
                              isVolumetric: true);
            }

            //Switch which rendertargets we show
            if (Input.WasKeyPressed(Keys.F1))
            {
                _renderModeCycle++;
                if (_renderModeCycle > Enum.GetNames(typeof(Renderer.Renderer.RenderModes)).Length - 1)
                {
                    _renderModeCycle = 0;
                }

                GameSettings.g_rendermode = (Renderer.Renderer.RenderModes)_renderModeCycle;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Main logic update function. Is called once per frame. Use this for all program logic and user inputs
        /// </summary>
        /// <param name="gameTime">Can use this to compute the delta between frames</param>
        /// <param name="isActive">The window status. If this is not the active window we shouldn't do anything</param>
        public void Update(GameTime gameTime, bool isActive)
        {
            if (!isActive)
            {
                return;
            }

            //Upd
            Input.Update(gameTime, Camera);

            if (GameSettings.s_rotateModel)
            {
                truck1.AngleZ += 0.5f * gameTime.ElapsedGameTime.TotalSeconds;
                truck2.AngleZ += 0.5f * gameTime.ElapsedGameTime.TotalSeconds;
            }
            //Make the lights move up and down
            //for (var i = 2; i < PointLights.Count; i++)
            //{
            //    PointLight point = PointLights[i];
            //    point.Position = new Vector3(point.Position.X, point.Position.Y, (float)(Math.Sin(gameTime.TotalGameTime.TotalSeconds * 0.8f + i) * 10 - 13));
            //}

            //KeyInputs for specific tasks

            //If we are currently typing stuff into the console we should ignore the following keyboard inputs
            if (DebugScreen.ConsoleOpen)
            {
                return;
            }

            //Starts the "editor mode" where we can manipulate objects
            //Spawns a new light on the ground
            if (Input.keyboardState.IsKeyDown(Keys.L))
            {
                AddPointLight(position: new Vector3(FastRand.NextSingle() * 250 - 125, FastRand.NextSingle() * 50 - 25, FastRand.NextSingle() * 30 - 19),
                              radius: 20,
                              color: FastRand.NextColor(),
                              intensity: 10,
                              castShadows: false,
                              isVolumetric: true);
            }

            //Switch which rendertargets we show
            if (Input.WasKeyPressed(Keys.F1))
            {
                _renderModeCycle++;
                if (_renderModeCycle > 11)
                {
                    _renderModeCycle = 0;
                }

                switch (_renderModeCycle)
                {
                }
            }
        }