コード例 #1
0
ファイル: MainMenu.cs プロジェクト: Andy0903/AIPacmanLab1.3
 override protected void DrawKeyboardInstructions(SpriteBatch aSpriteBatch)
 {
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Press ENTER to start", WindowManager.WindowHeight - WindowManager.WindowHeight / 1.4f, Color.Red);
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Press SPACE for highscores", WindowManager.WindowHeight - WindowManager.WindowHeight / 1.5f, Color.Red);
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Press O for options", WindowManager.WindowHeight - WindowManager.WindowHeight / 1.6f, Color.Red);
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Press ESCAPE to exit", WindowManager.WindowHeight - WindowManager.WindowHeight / 2f, Color.Red);
 }
コード例 #2
0
        virtual protected void DrawUnchangingText(SpriteBatch aSpriteBatch, string aTitle)
        {
            string astring = GameBoard.PlaythroughTime.ToString();

            OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 2f, aTitle, WindowManager.WindowHeight - WindowManager.WindowHeight / 1.1f, Color.DeepPink);
            OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Time spent: " + TimeSpan.FromMilliseconds(int.Parse(astring)).ToString(@"hh\:mm\:ss\.fff"),
                                               WindowManager.WindowHeight - WindowManager.WindowHeight / 1.15f, Color.White);
        }
コード例 #3
0
        private void DrawHighscores(SpriteBatch aSpriteBatch)
        {
            List <string> strings = Highscore.ReadToFile();

            for (int i = 0; i < strings.Count; i++)
            {
                OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, strings[i],
                                                   WindowManager.WindowHeight / 6.4f + (i * WindowManager.WindowHeight / 19.2f),
                                                   Color.White);
            }
        }
コード例 #4
0
        void ot_Rotate(OutlinedText ot, double offsetAngle, MouseWheelEventArgs e)
        {
            double angle = ((RotateTransform)ot.RenderTransform).Angle;

            angle %= 360.0;
            if (e.Source != null && e.Delta < 0)
            {
                angle += offsetAngle;
            }
            else
            {
                angle -= offsetAngle;
            }
            ot.RenderTransform = new RotateTransform(angle);
        }
コード例 #5
0
        private void DrawHighscores(SpriteBatch aSpriteBatch)
        {
            List <string> strings = Highscore.ReadFromFile();

            for (int i = 0; i < strings.Count; i++)
            {
                strings[i] = TimeSpan.FromMilliseconds(int.Parse(strings[i])).ToString(@"hh\:mm\:ss\.fff");
            }

            for (int i = 0; i < strings.Count; i++)
            {
                OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, strings[i],
                                                   WindowManager.WindowHeight / 6.4f + (i * WindowManager.WindowHeight / 19.2f),
                                                   Color.White);
            }
        }
コード例 #6
0
        void ot_Rotate(OutlinedText ot, double offsetAngle, MouseButtonEventArgs e)
        {
            double angle = ((RotateTransform)ot.RenderTransform).Angle;

            angle %= 360.0;
            if (e.Source != null && e.ChangedButton == MouseButton.Left)
            {
                angle += offsetAngle;
            }
            else
            {
                angle -= offsetAngle;
            }
            if (e.ClickCount > 0)
            {
                angle *= e.ClickCount;
            }
            ot.RenderTransform = new RotateTransform(angle);
        }
コード例 #7
0
        public void SetLabelState(OutlinedText text, LabelStates state)
        {
            switch (state)
            {
            case LabelStates.Error:
                text.Fill   = Brushes.Red;
                text.Stroke = Brushes.DarkRed;
                StartSc2ReplayMonkey();
                break;

            case LabelStates.InProgress:
                text.Fill   = Brushes.Orange;
                text.Stroke = Brushes.OrangeRed;
                break;

            case LabelStates.Validated:
                text.Stroke = Brushes.Green;
                text.Fill   = Brushes.LightGreen;
                break;
            }
        }
コード例 #8
0
        private void DrawKeybindings(SpriteBatch aSpriteBatch)
        {
            OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "UP",
                                               WindowManager.WindowHeight - WindowManager.WindowHeight / 1.5f, Color.Gold);

            OutlinedText.DrawCenteredText(aSpriteBatch, myFont, 1.5f, "LEFT",
                                          new Vector2(WindowManager.WindowWidth - WindowManager.WindowWidth / 1.8f, WindowManager.WindowHeight - WindowManager.WindowHeight / 1.65f), Color.Turquoise);

            OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "DOWN",
                                               WindowManager.WindowHeight - WindowManager.WindowHeight / 1.8f, Color.Lime);

            OutlinedText.DrawCenteredText(aSpriteBatch, myFont, 1.5f, "RIGHT",
                                          new Vector2(WindowManager.WindowWidth - WindowManager.WindowWidth / 2.3f, WindowManager.WindowHeight - WindowManager.WindowHeight / 1.65f), Color.DarkOrange);

            for (int i = 0; i < myTooltips.Count; i++)
            {
                switch (i)
                {
                case 0:
                case 1:
                    myTooltips[i].Draw(aSpriteBatch, Color.Gold);
                    break;

                case 2:
                case 3:
                    myTooltips[i].Draw(aSpriteBatch, Color.Turquoise);
                    break;

                case 4:
                case 5:
                    myTooltips[i].Draw(aSpriteBatch, Color.Lime);
                    break;

                case 6:
                case 7:
                    myTooltips[i].Draw(aSpriteBatch, Color.DarkOrange);
                    break;
                }
            }
        }
コード例 #9
0
 void SetOutlinedText(OutlinedText ot)
 {
     //Clipboard.SetText(ot.ToXAML());
     Clipboard.SetText(ot.ToString());
     MessageBox.Show(this, "Copied to Clipboard", this.Title, MessageBoxButton.OK, MessageBoxImage.Information);
 }
コード例 #10
0
 public MainWorkerHelper(MainWindow _Main, TheOmniscientChimp.UpdaterLogic.LabelStates _State, OutlinedText _Text)
 {
     Main       = _Main;
     LabelState = _State;
     Text       = _Text;
 }
コード例 #11
0
 override protected void DrawKeyboardInstructions(SpriteBatch aSpriteBatch)
 {
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Press ENTER to restart", WindowManager.WindowHeight - WindowManager.WindowHeight / 1.4f, Color.Red);
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Press ESCAPE to return to menu", WindowManager.WindowHeight - WindowManager.WindowHeight / 2f, Color.Red);
 }
コード例 #12
0
 override protected void DrawXboxControllerInstructions(SpriteBatch aSpriteBatch)
 {
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Press A to restart", WindowManager.WindowHeight - WindowManager.WindowHeight / 1.4f, Color.Yellow);
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Press B to return to menu", WindowManager.WindowHeight - WindowManager.WindowHeight / 2f, Color.Yellow);
 }
コード例 #13
0
 override protected void DrawUnchangingText(SpriteBatch aSpriteBatch)
 {
     DrawUnchangingText(aSpriteBatch, "Game Over");
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Time spent won't be saved if you do not win",
                                        WindowManager.WindowHeight - WindowManager.WindowHeight / 3f, Color.PapayaWhip);
 }
コード例 #14
0
        public ListColorsEvenElegantlier()
        {
            Title = "List Colors Even Elegantlier";
            MakeResources();
            Border world = new Border();

            world.BorderThickness = new Thickness(50);
            world.CornerRadius    = new CornerRadius(70.710678118654752440084436210485);
            Grid grid = new Grid();

            world.Child = grid;
            {
                Grid area = new Grid();
                area.HorizontalAlignment = HorizontalAlignment.Right;
                area.VerticalAlignment   = VerticalAlignment.Bottom;
                ListBox lstbox = A = ElegantColorChooser();
                A.SelectionChanged += new SelectionChangedEventHandler(A_SelectionChanged);
                // Bind the SelectedValue to window Background.
                lstbox.SelectedValuePath = "Brush";
                lstbox.SetBinding(ListBox.SelectedValueProperty, "Background");
                lstbox.DataContext = world;
                area.Children.Add(lstbox);
                grid.Children.Add(area);
            }
            {
                Grid area = new Grid();
                area.HorizontalAlignment = HorizontalAlignment.Left;
                area.VerticalAlignment   = VerticalAlignment.Bottom;
                ListBox lstbox = B = ElegantColorChooser();
                B.SelectionChanged += new SelectionChangedEventHandler(B_SelectionChanged);
                // Bind the SelectedValue to window Background.
                lstbox.SelectedValuePath = "Brush";
                lstbox.SetBinding(ListBox.SelectedValueProperty, "BorderBrush");
                lstbox.DataContext = world;
                area.Children.Add(lstbox);
                grid.Children.Add(area);
            }
            {
                Grid area = new Grid();
                area.HorizontalAlignment = HorizontalAlignment.Center;
                area.VerticalAlignment   = VerticalAlignment.Center;
                grad                 = new Border();
                grad.Name            = "grad";
                grad.BorderThickness = new Thickness(20);
                grad.CornerRadius    = new CornerRadius(28.284271247461900976033774484194);
                //grad.Background=Brushes.Black;
                //grad.BorderBrush=Brushes.Teal;
                box        = new Grid();
                box.Width  = 200;
                box.Height = 200;
                grad.Child = box;
                area.Children.Add(grad);
                grid.Children.Add(area);
            }
            grid.RowDefinitions.Add(new RowDefinition());
            grid.RowDefinitions.Add(new RowDefinition());
            grid.RowDefinitions[0].Height = new GridLength(300, GridUnitType.Star);
            grid.RowDefinitions[1].Height = new GridLength(50);
            grid.ShowGridLines            = false;

            {
                block               = new TextBlock();
                block.Text          = "This is a sample text.";
                block.TextAlignment = TextAlignment.Center;
                block.FontFamily    = new FontFamily("Segou UI");
                block.FontSize      = 32;
                Binding myBinding = new Binding("SelectedValue");
                myBinding.Source = B;
                block.SetBinding(TextBlock.ForegroundProperty, myBinding);
                grid.Children.Add(block);
                Grid.SetRow(block, 1);
            }
            {
                border               = new TextBlock();
                border.Text          = "This is a sample text.";
                border.TextAlignment = TextAlignment.Center;
                border.FontFamily    = new FontFamily("Segou UI");
                border.FontSize      = 32;
                Binding myBinding = new Binding("SelectedValue");
                myBinding.Source = A;
                border.SetBinding(TextBlock.ForegroundProperty, myBinding);
                border.RenderTransform = new TranslateTransform(0, 60);
                grid.Children.Add(border);
                Grid.SetRow(border, 1);
            }
            {
                ot                       = new OutlinedText();
                ot.MouseDown            += new MouseButtonEventHandler(ot_MouseDown);
                ot.Text                  = "This is a sample text.";
                ot.FontFamily            = new FontFamily("Maiandra GD");
                ot.FontSize              = 50;
                ot.FontWeight            = FontWeights.Bold;
                ot.StrokeThickness       = 2;
                ot.RenderTransformOrigin = new Point(0.5, 0.5);
                ot.HorizontalAlignment   = HorizontalAlignment.Center;
                ot.VerticalAlignment     = VerticalAlignment.Center;
                Binding bindFill = new Binding("SelectedValue");
                bindFill.Source = A;
                ot.SetBinding(OutlinedText.FillProperty, bindFill);
                Binding bindStor = new Binding("SelectedValue");
                bindStor.Source = B;
                ot.SetBinding(OutlinedText.StrokeProperty, bindStor);
                ot.RenderTransform = new RotateTransform(-90);
                grid.Children.Add(ot);
                Grid.SetRow(ot, 0);
            }

            Content             = world;
            this.MouseDown     += new MouseButtonEventHandler(ListColorsEvenElegantlier_MouseDown);
            this.MouseWheel    += new MouseWheelEventHandler(ListColorsEvenElegantlier_MouseWheel);
            this.ot.MouseWheel += new MouseWheelEventHandler(ot_MouseWheel);
        }
コード例 #15
0
ファイル: GameBoard.cs プロジェクト: Andy0903/PacmanAlgoritm
 private void DrawLivesText(SpriteBatch aSpriteBatch)
 {
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Lives: " + Player.Lives, WindowManager.WindowHeight - WindowManager.WindowHeight / 12, Color.Yellow);
 }
コード例 #16
0
ファイル: MainMenu.cs プロジェクト: Andy0903/AIPacmanLab1.3
 override protected void DrawUnchangingText(SpriteBatch aSpriteBatch)
 {
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 2f, "Pacman", WindowManager.WindowHeight - WindowManager.WindowHeight / 1.1f, Color.DeepPink);
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.2f, "by Andreas Gustafsson", WindowManager.WindowHeight - WindowManager.WindowHeight / 1.15f);
 }
コード例 #17
0
 override protected void DrawUnchangingText(SpriteBatch aSpriteBatch)
 {
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 2f, "Highscores (Speed run)", WindowManager.WindowHeight - WindowManager.WindowHeight / 1.1f, Color.DeepPink);
     DrawHighscores(aSpriteBatch);
 }
コード例 #18
0
 override protected void DrawUnchangingText(SpriteBatch aSpriteBatch)
 {
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 2f, "Game Over", WindowManager.WindowHeight - WindowManager.WindowHeight / 1.1f, Color.DeepPink);
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Score: " + GameBoard.Score, WindowManager.WindowHeight - WindowManager.WindowHeight / 1.15f, Color.White);
 }
コード例 #19
0
 override protected void DrawUnchangingText(SpriteBatch aSpriteBatch)
 {
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 2f, "Options", WindowManager.WindowHeight - WindowManager.WindowHeight / 1.1f, Color.DeepPink);
     DrawKeybindings(aSpriteBatch);
 }
コード例 #20
0
ファイル: GameBoard.cs プロジェクト: Andy0903/PacmanAlgoritm
 private void DrawScoreText(SpriteBatch aSpriteBatch)
 {
     OutlinedText.DrawWidthCenteredText(aSpriteBatch, myFont, 1.5f, "Score: " + Score, WindowManager.WindowHeight - WindowManager.WindowHeight / 16, Color.Yellow);
 }
コード例 #21
0
 private void DrawText(SpriteBatch aSpriteBatch)
 {
     OutlinedText.DrawCenteredText(aSpriteBatch, myFont, 2f, myLives.ToString(),
                                   new Vector2(WindowRelativePosition.X + Texture.Width / 2, WindowRelativePosition.Y + Texture.Height / 2));
 }