Beispiel #1
0
        private static string Benchmark(int frameCount, IBufferedAbsConsole <CHAR_INFO> screen)
        {
            var r    = new Random();
            var stop = new Stopwatch();

            stop.Start();
            for (int i = 0; i < frameCount; i++)
            {
                var x   = r.Next(screen.Width);
                var y   = r.Next(screen.Height);
                var a   = r.Next(26);
                var clr = r.Next(0, 255);

                screen[x, y] = new CHAR_INFO(TestHelper.GetCharOffset('A', a), (ushort)clr);
                screen.Update();

                if (i % 50 == 0)
                {
                    System.Console.Title = i.ToString();
                }
            }

            stop.Stop();
            return($"{frameCount} frames in {stop.Elapsed} at {frameCount / stop.Elapsed.TotalSeconds} FPS");
        }
 public void Init()
 {
     ConsoleZ.DirectConsole.Setup(Size.X, Size.Y, 10, 10, "Consolas");
     ConsoleZ.DirectConsole.Fill(' ', 0);
     screenDevice = ConsoleZ.DirectConsole.Singleton;
 }