Exemplo n.º 1
0
        public void Update(GameTime gameTime)
        {
            //Update the forms
            m_forms.Update();

            //Do the event handling
            if (!m_forms[s_mainMenuTitle].bVisible)
            {
                mainForm_Closed();
            }
            if (m_forms[s_mainMenuOptions].bVisible != m_prevOptionsFormVisibility)
            {
                if (!m_forms[s_mainMenuOptions].bVisible)
                {
                    optionsForm_Closed();
                }
            }

            //Update the event variables
            m_prevOptionsFormVisibility = m_forms[s_mainMenuOptions].bVisible;
        }
Exemplo n.º 2
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)
        {
            //Update the form collection
            FormCollection.Update(gameTime);

            KeyboardState keybState = Keyboard.GetState();

            if (keybState.IsKeyDown(Keys.LeftShift) || keybState.IsKeyDown(Keys.RightShift))
            {
                //il giro in 4 secondi => PI/2 al secondo
                float rads = (float)(gameTime.ElapsedGameTime.TotalSeconds * (Math.PI / 2));

                if (keybState.IsKeyDown(Keys.A))
                {
                    StatusCurrent.DirectionalLight0Direction =
                        Vector3.Transform(StatusCurrent.DirectionalLight0Direction, Matrix.CreateRotationY(rads));
                }
                if (keybState.IsKeyDown(Keys.D))
                {
                    StatusCurrent.DirectionalLight0Direction =
                        Vector3.Transform(StatusCurrent.DirectionalLight0Direction, Matrix.CreateRotationY(-rads));
                }

                if (keybState.IsKeyDown(Keys.W))
                {
                    StatusCurrent.DirectionalLight0Direction =
                        Vector3.Transform(StatusCurrent.DirectionalLight0Direction, Matrix.CreateRotationX(rads));
                }
                if (keybState.IsKeyDown(Keys.S))
                {
                    StatusCurrent.DirectionalLight0Direction =
                        Vector3.Transform(StatusCurrent.DirectionalLight0Direction, Matrix.CreateRotationX(-rads));
                }
            }
            if (keybState.IsKeyDown(Keys.LeftShift) || keybState.IsKeyDown(Keys.RightShift))
            {
                //il giro in 4 secondi => PI/2 al secondo
                float rads = (float)(gameTime.ElapsedGameTime.TotalSeconds * (Math.PI / 2));

                if (keybState.IsKeyDown(Keys.A))
                {
                    StatusCurrent.DirectionalLight0Direction =
                        Vector3.Transform(StatusCurrent.DirectionalLight0Direction, Matrix.CreateRotationY(rads));
                }
                if (keybState.IsKeyDown(Keys.D))
                {
                    StatusCurrent.DirectionalLight0Direction =
                        Vector3.Transform(StatusCurrent.DirectionalLight0Direction, Matrix.CreateRotationY(-rads));
                }

                if (keybState.IsKeyDown(Keys.W))
                {
                    StatusCurrent.DirectionalLight0Direction =
                        Vector3.Transform(StatusCurrent.DirectionalLight0Direction, Matrix.CreateRotationX(rads));
                }
                if (keybState.IsKeyDown(Keys.S))
                {
                    StatusCurrent.DirectionalLight0Direction =
                        Vector3.Transform(StatusCurrent.DirectionalLight0Direction, Matrix.CreateRotationX(-rads));
                }
            }
            else
            {
                if (keybState.IsKeyDown(Keys.F1))
                {
                    StatusCurrent.TransparentSide = TraspSide.InFrontOfWhite;
                }
                if (keybState.IsKeyDown(Keys.F2))
                {
                    StatusCurrent.TransparentSide = TraspSide.RightOfWhite;
                }
                if (keybState.IsKeyDown(Keys.F3))
                {
                    StatusCurrent.TransparentSide = TraspSide.InFrontOfBlack;
                }
                if (keybState.IsKeyDown(Keys.F4))
                {
                    StatusCurrent.TransparentSide = TraspSide.RightOfBlack;
                }
                //if (keybState.IsKeyDown(Keys.F11))
                //    StatusCurrent.AlphaTransparency = false;
                //if (keybState.IsKeyDown(Keys.F12))
                //    StatusCurrent.AlphaTransparency = true;
            }

            //Matrix.cre

            base.Update(gameTime);
        }