Beispiel #1
0
        /// <summary>
        /// Draw the screen
        /// </summary>
        private void Draw()
        {
            try
            {
                Clear();

                PollKeys();

                Console.CursorVisible = false;
                for (int i = 0; i < DisplayElements.Count; i++)
                {
                    currently_drawing = DisplayElements[i];

                    DisplayElements[i].Update();
                    DisplayElements[i].Draw(this);

                    if (DisplayElements[i].Outline)
                    {
                        SSDrawLine(DisplayElements[i].Left - 1, DisplayElements[i].Top - 1, DisplayElements[i].Left - 1, DisplayElements[i].Top + DisplayElements[i].Height + 1, '│');                                                        //Left edge
                        SSDrawLine(DisplayElements[i].Left - 1, DisplayElements[i].Top - 1, DisplayElements[i].Left + 1 + DisplayElements[i].Width, DisplayElements[i].Top - 1, '─');                                                         //Top edge
                        SSDrawLine(DisplayElements[i].Left + 1 + DisplayElements[i].Width, DisplayElements[i].Top - 1, DisplayElements[i].Left + 1 + DisplayElements[i].Width, DisplayElements[i].Top + 1 + DisplayElements[i].Height, '│');  //Right edge
                        SSDrawLine(DisplayElements[i].Left - 1, DisplayElements[i].Top + DisplayElements[i].Height + 1, DisplayElements[i].Left + 1 + DisplayElements[i].Width, DisplayElements[i].Top + 1 + DisplayElements[i].Height, '─'); //Bottom edge

                        SSDrawPixel(DisplayElements[i].Left - 1, DisplayElements[i].Top - 1, '+');
                        SSDrawPixel(DisplayElements[i].Left - 1, DisplayElements[i].Top + 1 + DisplayElements[i].Height, '+');
                        SSDrawPixel(DisplayElements[i].Left + 1 + DisplayElements[i].Width, DisplayElements[i].Top + 1 + DisplayElements[i].Height, '+');
                        SSDrawPixel(DisplayElements[i].Left + 1 + DisplayElements[i].Width, DisplayElements[i].Top - 1, '+');
                    }
                }

                Console.SetCursorPosition(0, 0);
                Console.Write(buffer.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Register an element to be drawn
 /// </summary>
 /// <param name="element">The element to be registered</param>
 public void RegisterElement(DisplayElement element)
 {
     DisplayElements.Add(element);
 }