예제 #1
0
 public static extern bool FillConsoleOutputAttribute(
     IntPtr hConsoleOutput,
     ushort wAttribute,
     uint nLength,
     COORD dwWriteCoord,
     out uint lpNumberOfAttrsWritten
     );
예제 #2
0
파일: LetterA.cs 프로젝트: constnil/ASCII
        protected override void Setup()
        {
            var letterA = new CHAR_INFO {
                AsciiChar = 'A',
            };

            letterA.Attributes = (UInt16)
                (FOREGROUND_RED | FOREGROUND_INTENSITY |
                 BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_INTENSITY);

            var charBufSize = new COORD {
                X = 1,
                Y = 1,
            };
            var characterPos = new COORD {
                X = 0,
                Y = 0,
            };

            var writeArea = new SMALL_RECT {
                Left = 0,
                Top = 0,
                Right = 0,
                Bottom = 0,
            };

            WriteConsoleOutput(
                WriteHandle, new CHAR_INFO[] { letterA }, charBufSize, characterPos, ref writeArea);
            Console.Write("\n");
        }
예제 #3
0
파일: Matrix.cs 프로젝트: constnil/ASCII
        protected override void Present()
        {
            var position = new COORD {
                    X = (short)Random.Next(Width),
                    Y = (short)Random.Next(Height),
                };

                if (Random.Next() % 2 == 0) {
                    SetConsoleTextAttribute(WriteHandle, 2);
                }
                else {
                    SetConsoleTextAttribute(WriteHandle, 10);
                }

                SetConsoleCursorPosition(WriteHandle, position);

                if (Random.Next() % 2 == 0) {
                    Console.Write("0");
                }
                else {
                    Console.Write("1");
                }
        }
예제 #4
0
        protected override void Setup()
        {
            var consoleBuffer = new CHAR_INFO[Width * Height];

            for (int h = 0; h < Height; ++h) {
                for (int w = 0; w < Width; ++w) {
                    consoleBuffer[w + Width * h].AsciiChar = 'A'/*(char)Random.Next(256)*/;
                    consoleBuffer[w + Width * h].Attributes = (UInt16)Random.Next(256);
                }
            }

            var charBufSize = new COORD {
                X = Width,
                Y = Height,
            };
            var characterPos = new COORD {
                X = 0,
                Y = 0,
            };

            WriteConsoleOutput(
                WriteHandle, consoleBuffer, charBufSize, characterPos, ref WindowSize);
        }
예제 #5
0
        public static void Initialize(string title, int width, int height)
        {
            WriteHandle   = GetStdHandle(STD_OUTPUT_HANDLE);
            Console.Title = title;

            Random = new Random(Guid.NewGuid().GetHashCode());
            Width  = (short)width;
            Height = (short)height;

            WindowSize = new SMALL_RECT {
                Left   = 0,
                Top    = 0,
                Right  = (short)(width - 1),
                Bottom = (short)(height - 1),
            };
            SetConsoleWindowInfo(WriteHandle, true, ref WindowSize);

            BufferSize = new COORD {
                X = 80,
                Y = 50,
            };
            SetConsoleScreenBufferSize(WriteHandle, BufferSize);
        }
예제 #6
0
파일: Scene.cs 프로젝트: constnil/ASCII
        public static void Initialize(string title, int width, int height)
        {
            WriteHandle = GetStdHandle(STD_OUTPUT_HANDLE);
            Console.Title = title;

            Random = new Random(Guid.NewGuid().GetHashCode());
            Width = (short)width;
            Height = (short)height;

            WindowSize = new SMALL_RECT {
                Left = 0,
                Top = 0,
                Right = (short)(width - 1),
                Bottom = (short)(height - 1),
            };
            SetConsoleWindowInfo(WriteHandle, true, ref WindowSize);

            BufferSize = new COORD {
                X = 80,
                Y = 50,
            };
            SetConsoleScreenBufferSize(WriteHandle, BufferSize);
        }
예제 #7
0
 public static extern bool WriteConsoleOutput(
     IntPtr hConsoleOutput,
     CHAR_INFO[] lpBuffer,
     COORD dwBufferSize,
     COORD dwBufferCoord,
     ref SMALL_RECT lpWriteRegion
     );
예제 #8
0
 public static extern bool SetConsoleScreenBufferSize(
     IntPtr hConsoleOutput,
     COORD dwSize
     );
예제 #9
0
 public static extern bool SetConsoleDisplayMode(
     IntPtr ConsoleOutput,
     uint Flags,
     out COORD NewScreenBufferDimensions
     );
예제 #10
0
 public static extern bool SetConsoleCursorPosition(
     IntPtr hConsoleOutput,
     COORD dwCursorPosition
     );
예제 #11
0
 public static extern bool ScrollConsoleScreenBuffer(
     IntPtr hConsoleOutput,
     [In] ref SMALL_RECT lpScrollRectangle,
     IntPtr lpClipRectangle,
     COORD dwDestinationOrigin,
     [In] ref CHAR_INFO lpFill
     );
예제 #12
0
 public static extern bool ReadConsoleOutputCharacter(
     IntPtr hConsoleOutput,
     [Out] StringBuilder lpCharacter,
     uint nLength,
     COORD dwReadCoord,
     out uint lpNumberOfCharsRead
     );
예제 #13
0
 public static extern bool ReadConsoleOutputAttribute(
     IntPtr hConsoleOutput,
     [Out] ushort[] lpAttribute,
     uint nLength,
     COORD dwReadCoord,
     out uint lpNumberOfAttrsRead
     );
예제 #14
0
파일: Types.cs 프로젝트: constnil/ASCII
 public WINDOW_BUFFER_SIZE_RECORD(short x, short y)
 {
     dwSize = new COORD();
     dwSize.X = x;
     dwSize.Y = y;
 }
예제 #15
0
 public static extern bool SetConsoleCursorPosition(
     IntPtr hConsoleOutput,
     COORD dwCursorPosition
     );
예제 #16
0
 public WINDOW_BUFFER_SIZE_RECORD(short x, short y)
 {
     dwSize   = new COORD();
     dwSize.X = x;
     dwSize.Y = y;
 }
예제 #17
0
 public static extern bool SetConsoleScreenBufferSize(
     IntPtr hConsoleOutput,
     COORD dwSize
     );
예제 #18
0
 public static extern bool SetConsoleDisplayMode(
     IntPtr ConsoleOutput,
     uint Flags,
     out COORD NewScreenBufferDimensions
     );
예제 #19
0
 public static extern bool FillConsoleOutputCharacter(
     IntPtr hConsoleOutput,
     char cCharacter,
     uint nLength,
     COORD dwWriteCoord,
     out uint lpNumberOfCharsWritten
     );
예제 #20
0
 public static extern bool ReadConsoleOutput(
     IntPtr hConsoleOutput,
     [Out] CHAR_INFO[] lpBuffer,
     COORD dwBufferSize,
     COORD dwBufferCoord,
     ref SMALL_RECT lpReadRegion
     );