예제 #1
0
        protected override void OnUpdate(GameTime gameTime)
        {
            base.OnUpdate(gameTime);

            _backgroundSkyBox.Update(gameTime);

            _rotation += (float)gameTime.ElapsedGameTime.TotalMilliseconds / (1000.0f / 20.0f);

            _splashText.Scale = 0.65f + (float)Math.Abs(Math.Sin(MathHelper.ToRadians(_rotation * 10.0f))) * 0.5f;

            var mousePos = Alex.InputManager.CursorInputListener.GetCursorPosition();

            mousePos = Vector2.Transform(mousePos, Alex.GuiManager.ScaledResolution.InverseTransformMatrix);
            var playerPos = _playerView.RenderBounds.Center.ToVector2();

            var mouseDelta = (new Vector3(playerPos.X, playerPos.Y, _playerViewDepth) - new Vector3(mousePos.X, mousePos.Y, 0.0f));

            mouseDelta.Normalize();

            var headYaw = (float)mouseDelta.GetYaw();
            var pitch   = (float)mouseDelta.GetPitch();
            var yaw     = (float)headYaw;

            _playerView.SetEntityRotation(-yaw, pitch, -headYaw);

            KeyboardState s = Keyboard.GetState();

            if (_prevKeyboardState.IsKeyDown(Keys.M) && s.IsKeyUp(Keys.M))
            {
                _mainMenu.ModernStyle = !_mainMenu.ModernStyle;
            }

            _prevKeyboardState = s;
        }
 protected override void OnUpdate(GameTime gameTime)
 {
     _skyBox.Update(gameTime);
     base.OnUpdate(gameTime);
 }
예제 #3
0
 protected override void OnUpdate(GameTime gameTime)
 {
     base.OnUpdate(gameTime);
     _backgroundSkyBox.Update(gameTime);
 }