Example #1
0
        private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            switch (e.Key)
            {
                #region effect settings
            case Key.D1:
                if (ToneGrid.Effect == null)
                {
                    ToneGrid.Effect = new ColorToneEffect();
                    ((ColorToneEffect)ToneGrid.Effect).DarkColor = Colors.Black;
                }
                ((ColorToneEffect)ToneGrid.Effect).Toned++;
                break;

            case Key.D2:
                if (ToneGrid.Effect == null)
                {
                    ToneGrid.Effect = new ColorToneEffect();
                    ((ColorToneEffect)ToneGrid.Effect).DarkColor = Colors.Black;
                }
                ((ColorToneEffect)ToneGrid.Effect).Toned--;
                break;

            case Key.D3:
                ((PixelateEffect)PixelGrid.Effect).HorizontalPixelCounts++;
                ((PixelateEffect)PixelGrid.Effect).VerticalPixelCounts++;
                break;

            case Key.D4:
                ((PixelateEffect)PixelGrid.Effect).HorizontalPixelCounts--;
                ((PixelateEffect)PixelGrid.Effect).VerticalPixelCounts--;
                break;

            case Key.D5:
                ((BloomEffect)BloomGrid.Effect).BloomIntensity++;
                //     ((PixelateEffect)BloomGrid.Effect);
                break;

            case Key.D6:
                ((BloomEffect)BloomGrid.Effect).BloomIntensity--;
                //     ((PixelateEffect)BloomGrid.Effect);
                break;

            case Key.D7:
                ((BloomEffect)BloomGrid.Effect).BaseIntensity++;
                //     ((PixelateEffect)BloomGrid.Effect);
                break;

            case Key.D8:
                ((BloomEffect)BloomGrid.Effect).BaseIntensity--;
                //     ((PixelateEffect)BloomGrid.Effect);
                break;
                #endregion

            case Key.Return:
                EntSound.Play();
                string   upperText = ((TermBind)DataContext).DispText.ToUpper();
                string[] lines     = upperText.Split(new char[1] {
                    '\n'
                });
                string[] words = lines[lines.Length - 1].Split(new char[1] {
                    ' '
                });
                if (!TermBind.IsOpen)
                {
                    if (words.Length >= 2)
                    {
                        Command.Arguement = words[1];
                    }
                    else
                    {
                        Command.Arguement = "None";
                    }
                    TermBind.IsOpen = true;
                    CurList.CallCommand(words[0]);
                }
                else
                {
                    Command.Arguement = words[0];
                }
                break;

            case Key.Left:
                if (!TermBind.IsOpen)
                {
                    break;
                }
                Curve.rightTurn = false;
                Curve.leftTurn  = true;
                Snake.SnakeDir  = (Snake.Direction)((int)(++Snake.SnakeDir) % 4);
                break;

            case Key.Right:
                if (!TermBind.IsOpen)
                {
                    break;
                }
                Curve.rightTurn = true;
                Curve.leftTurn  = false;
                if (Snake.SnakeDir == Snake.Direction.LEFT)
                {
                    Snake.SnakeDir = Snake.Direction.DOWN;
                }
                else
                {
                    Snake.SnakeDir--;
                }

                break;
            }
        }