Example #1
0
        public void Render(IAtomicConsole console)
        {
            // TODO: check if animation frame time has passed for this animation, if so - animate!
            // there might be various types of animators - changing with frames, seconds, different speeds or only after change occurred (some progress bars)

            // TODO: also, check whether animation is not out of the screen / buffer - it's kind of stupid to render something offscreen
            // TODO: track indirect positions in buffer as well and transform positions? Another event?

            this.OnRenderFrame(console);
        }
Example #2
0
 public static void PrintColorfullTextSync(this IAtomicConsole console, params KeyValuePair <ConsoleFontColor, string>[] texts)
 {
     console.RunAtomicOperations(ac =>
     {
         foreach (var pair in texts)
         {
             ac.WriteText(pair.Key, pair.Value);
         }
     }
                                 );
 }
Example #3
0
        public ConsoleMenu(IAtomicConsole console, Rectangle availableArea, IEnumerable <ConsoleMenuItem> menuItems, MenuStyles styling)
        {
            this._console       = console ?? throw new ArgumentNullException(nameof(console));
            this._availableArea = availableArea;
            this._styling       = styling ?? throw new ArgumentNullException(nameof(styling));

            if (menuItems != null)
            {
                this._menuItems    = menuItems.ToList();
                this._selectedItem = this._menuItems.FirstOrDefault();
            }
            else
            {
                this._menuItems = new List <ConsoleMenuItem>();
            }
        }
Example #4
0
        public static void CleanLineSync(this IAtomicConsole console, int?lineNo = null, Color?color = null)   // add colors...
        {
            if (console == null)
            {
                throw new ArgumentNullException(nameof(console));
            }

            console.RunAtomicOperations((ac =>
            {
                lineNo = lineNo ?? ac.GetCursorPosition().Y;
                color = color ?? Color.Black;

                string text = new string(' ', console.WindowWidth);
                ac.SetCursorPosition(0, lineNo.Value);
                ac.WriteText(0, lineNo.Value, text, color.Value, color.Value);
            }));
        }
Example #5
0
 protected override void OnRenderFrame(IAtomicConsole console)
 {
     var lines = (DisplayedText ?? "")
                 .SplitTextToFit((uint)OccupiedArea.Width) // do not overflow horizontally
                 .Take(OccupiedArea.Height);               // do not overflow vertically
 }
Example #6
0
 protected abstract void OnRenderFrame(IAtomicConsole console);