コード例 #1
0
ファイル: Playground.cs プロジェクト: afliw/console-tetris
 public static void SensibilizeCell(int x, int y, int Height, int Width)
 {
     if (!Shadow)
     {
         return;
     }
     DeSensibilizeCell();
     ushort[,] SensColor    = new ushort[1, 1];
     SensColor[0, 0]        = (ushort)ConsoleColor.Gray;
     ushort[,] TempBuffer   = new ushort[1, 1];
     LastSensibilizedNumber = Width;
     for (int i = 0; i < Width; i++)
     {
         for (int j = Height + y; j < 25; j++)
         {
             if (Matriz[x + i, j])
             {
                 TempBuffer = ConsoleFunctions.ReadConsoleAttribute(x + i, j, 1, 1);
                 LastSensibilizedColors[0, i] = TempBuffer[0, 0];
                 ConsoleFunctions.WriteConsoleAttribute(x + i, j, SensColor);
                 LastSensibilizedPosition[i].X = x + i;
                 LastSensibilizedPosition[i].Y = j;
                 break;
             }
         }
     }
 }
コード例 #2
0
ファイル: Playground.cs プロジェクト: afliw/console-tetris
 private static void FlashScreen()
 {
     if (!Flash)
     {
         return;
     }
     ushort[,] FlashingColors = new ushort[Console.BufferHeight, Console.BufferWidth];
     for (int i = 0; i < FlashingColors.GetLength(0); i++)
     {
         for (int j = 0; j < FlashingColors.GetLength(1); j++)
         {
             FlashingColors[i, j] = 123;
         }
     }
     ushort[,] SaveAttributes = ConsoleFunctions.ReadConsoleAttribute(0, 0, Console.BufferWidth, Console.BufferHeight);
     for (int Times = 0; Times < 4; Times++)
     {
         ConsoleFunctions.WriteConsoleAttribute(0, 0, FlashingColors);
         Thread.Sleep(45);
         ConsoleFunctions.WriteConsoleAttribute(0, 0, SaveAttributes);
         Thread.Sleep(45);
     }
 }