Exemplo n.º 1
0
        //====== private methods

        private void PaintTitle(TextCanvas windowView)
        {
            if (windowView.Size.Width < 7)
            {
                return;
            }

            var titleView = windowView.Slice(new Rectangle(new Point(2, 0), new Size(windowView.Size.Width - 6, 1)));

            titleView.WriteText(Point.Zero, " " + Title + " ", Appearance.TitleTextColor, Appearance.BackColor);
        }
Exemplo n.º 2
0
        //====== private methods

        private void PaintStatsWindow(TextCanvas canvas)
        {
            var statsView = canvas.Slice(canvas.Size.AsRectangle.ChangeWidth(30));

            statsView.ClearColor(Color16.DarkBlue);

            var app         = new WindowAppearance(Color16.Black, Color16.Teal, Color16.Lime, true);
            var statsWindow = new StatsWindow(playerName, gameLogic.GetStatus(), statsView.Size, app);

            statsWindow.Paint(statsView, Point.Zero);
        }
Exemplo n.º 3
0
        public override void ProcessCanvas(TextCanvas canvas)
        {
            canvas.ClearColor(Color16.Black);

            terrainRenderer.Paint(gameLogic.TerrainReader, canvas, new Point(31, 0));

            PaintStatsWindow(canvas);

            var scoreView = canvas.Slice(new Rectangle(new Point(1, 21), new Size(28, 76)));

            scoreView.WriteTextCenter(0, new string( '─', scoreView.Size.Width ), Color16.Teal, Color16.Black);
            scoreView.WriteTextCenter(0, " SCORE ", Color16.Yellow, Color16.Black);

            bigDigitsScoreUI.DrawCenter(scoreView, 2);
        }
Exemplo n.º 4
0
        //====== public methods

        public void Paint(TextCanvas canvas, Point position)
        {
            Verify.NotNull(canvas, nameof(canvas));

            if (Size.Width < 3 || Size.Height < 3)
            {
                return;                                    // no reason to draw such small window...
            }
            //--- paint background and border

            var windowView = canvas.Slice(new Rectangle(position, Size));

            windowView.ClearColor(Appearance.BackColor);
            windowView.Frame(windowView.Size.AsRectangle, Appearance.BorderColor, Appearance.BackColor, Appearance.ThinBorder);

            PaintTitle(windowView);

            //--- paint content

            var contentArea = new Rectangle(new Point(1, 1), new Size(windowView.Size.Width - 2, windowView.Size.Height - 2));
            var contentView = windowView.Slice(contentArea);

            PaintContent(contentView);
        }