Exemplo n.º 1
0
 public static bool isPressed(Buttons b)
 {
     for (int i = 0; i < 4; i++)
         if (currentGamepad[i].IsButtonDown(b) && lastGamepad[i].IsButtonUp(b))
             return true;
     return false;
 }
Exemplo n.º 2
0
 public void clear()
 {
     key = 0;
     btn = 0;
     thumb = false;
     trigs = false;
 }
Exemplo n.º 3
0
 public void set(int i, Buttons b)
 {
     clear();
     index = i;
     btn = b;
 }
Exemplo n.º 4
0
 public void MakeButtons()
 {
     for (int row = 1; row < 9; row++)
     {
         for (int column = 0; column < 8; column++)
         {
             StackPanel stackPanel = (StackPanel)GetGridElement(CheckersGrid, row, column);
             Button button = new Button();
             button.Click += new RoutedEventHandler(button_Click);
             button.Height = 30;
             button.Width = 30;
             button.HorizontalAlignment = HorizontalAlignment.Center;
             button.VerticalAlignment = VerticalAlignment.Center;
             Buttons gameStartButton = new Buttons();
             var redBrush = new ImageBrush();
             redBrush.ImageSource = new BitmapImage(new Uri("Images/Red.png", UriKind.Relative));
             var blackBrush = new ImageBrush();
             blackBrush.ImageSource = new BitmapImage(new Uri("Images/Black.png", UriKind.Relative));
             switch (row)
             {
                 case 1:
                     if (column % 2 != 0)
                     {
                         gameStartButton.MakeRedButton(button, redBrush, stackPanel, row, column);
                     }
                     break;
                 case 2:
                     if (column % 2 == 0)
                     {
                         gameStartButton.MakeRedButton(button, redBrush, stackPanel, row, column);
                     }
                     break;
                 case 3:
                     if (column % 2 != 0)
                     {
                         gameStartButton.MakeRedButton(button, redBrush, stackPanel, row, column);
                     }
                     break;
                 case 4:
                     if (column % 2 == 0)
                     {
                         gameStartButton.MakePlainButton(button, stackPanel, row, column);
                     }
                     break;
                 case 5:
                     if (column % 2 != 0)
                     {
                         gameStartButton.MakePlainButton(button, stackPanel, row, column);
                     }
                     break;
                 case 6:
                     if (column % 2 == 0)
                     {
                         gameStartButton.MakeBlackButton(button, blackBrush, stackPanel, row, column);
                     }
                     break;
                 case 7:
                     if (column % 2 != 0)
                     {
                         gameStartButton.MakeBlackButton(button, blackBrush, stackPanel, row, column);
                     }
                     break;
                 case 8:
                     if (column % 2 == 0)
                     {
                         gameStartButton.MakeBlackButton(button, blackBrush, stackPanel, row, column);
                     }
                     break;
                 default:
                     break;
             }
         }
     }
 }