예제 #1
0
 protected override void OnPaint(ConsoleBitmap context)
 {
     if ((Element as Projectile).Pen != null && (Element as Projectile).Pen.Length > 0)
     {
         context.Pen = (Element as Projectile).Pen[0];
     }
     context.FillRectUnsafe(0, 0, Width, Height);
 }
예제 #2
0
 protected override void OnPaint(ConsoleBitmap context)
 {
     context.Pen = new ConsoleCharacter(' ', backgroundColor: BorderElement.BackgroundColor);
     context.FillRectUnsafe(0, 0, Width, Height);
     context.Pen = new ConsoleCharacter(' ', backgroundColor: BorderElement.BorderColor);
     context.DrawLine(0, 0, 0, Height);
     context.DrawLine(1, 0, 1, Height);
     context.DrawLine(Width - 1, 0, Width - 1, Height);
     context.DrawLine(Width - 2, 0, Width - 2, Height);
     context.DrawLine(0, 0, Width, 0);
     context.DrawLine(0, Height - 1, Width, Height - 1);
 }
예제 #3
0
        public void TestPlaybackEndToEnd()
        {
            int w = 10, h = 1;
            var temp = Path.GetTempFileName();

            using (var stream = File.OpenWrite(temp))
            {
                var writer = new ConsoleBitmapStreamWriter(stream)
                {
                    CloseInnerStream = false
                };
                var bitmap = new ConsoleBitmap(w, h);

                for (var i = 0; i < bitmap.Width; i++)
                {
                    bitmap.Pen = new ConsoleCharacter(' ');
                    bitmap.FillRectUnsafe(0, 0, bitmap.Width, bitmap.Height);
                    bitmap.Pen = new ConsoleCharacter(' ', backgroundColor: ConsoleColor.Red);
                    bitmap.DrawPoint(i, 0);
                    writer.WriteFrame(bitmap, true, TimeSpan.FromSeconds(.5 * i));
                }
                writer.Dispose();
            }

            var app = new CliTestHarness(this.TestContext, 80, 30);

            app.InvokeNextCycle(() =>
            {
                var player = app.LayoutRoot.Add(new ConsoleBitmapPlayer()).Fill();
                player.Load(File.OpenRead(temp));
                app.SetTimeout(() => app.SendKey(new ConsoleKeyInfo('p', ConsoleKey.P, false, false, false)), TimeSpan.FromMilliseconds(100));
                var playStarted = false;
                player.SubscribeForLifetime(nameof(player.State), () =>
                {
                    if (player.State == PlayerState.Playing)
                    {
                        playStarted = true;
                    }
                    else if (player.State == PlayerState.Stopped && playStarted)
                    {
                        app.Stop();
                    }
                }, app);
            });

            app.Start().Wait();
            Thread.Sleep(100);
            app.AssertThisTestMatchesLKGFirstAndLastFrame();
        }
예제 #4
0
        protected override void OnPaint(ConsoleBitmap context)
        {
            var w = Element as Wall;

            if (w.Pen.HasValue)
            {
                context.Pen = w.Pen.Value;
            }
            else
            {
                context.Pen = Style;
            }

            context.FillRectUnsafe(0, 0, Width, Height);
        }
예제 #5
0
파일: Fire.cs 프로젝트: jiaw37/PowerArgs
 protected override void OnPaint(ConsoleBitmap context)
 {
     context.Pen = new ConsoleCharacter(symbol, color);
     context.FillRectUnsafe(0, 0, Width, Height);
 }
예제 #6
0
 protected override void OnPaint(ConsoleBitmap context)
 {
     context.Pen = new ConsoleCharacter(Math.Ceiling((Element as TimedMine).SecondsRemaining).ToString()[0], ConsoleColor.Black, ConsoleColor.DarkYellow);
     context.FillRectUnsafe(0, 0, Width, Height);
 }
예제 #7
0
 protected override void OnPaint(ConsoleBitmap context)
 {
     context.Pen = (Element as FlammableLetter).Symbol;
     context.FillRectUnsafe(0, 0, Width, Height);
 }