Example #1
0
        public Pages TestPage()
        {
            Console.Clear();

            FreeStringList sh             = new FreeStringList();
            Menu           scrollableTest = new Menu(20, 20, 10, "Shop", width: 10, menuStyle: BoxStyle.Limited);
            BoundaryBox    box            = new BoundaryBox(new XYPair(19, 19), new XYPair(15, 12));

            for (int i = 0; i < 20; i++)
            {
                scrollableTest.AddItem(new MenuItem($"Shop Item {i}"));
            }


            objH.PrintImage(new XYPair(40, 5), "Pikachu");
            box.Print();
            int digits = scrollableTest.EnterMenuLoop();


            Numbers number = new Numbers(digits, new XYPair(40, 25));
            int     result = number.EnterMainLoop();


            StringRenderer.PrintFreeString(new FreeString(20, result.ToString()));
            Console.Read();

            return(Pages.TestPage);
        }
Example #2
0
        public void Print(XYPair position, string imageName)
        {
            int index = images.FindIndex(f => f.name == imageName);

            if (index >= 0)
            {
                Image imageSelected = images[index];
                GraphicRenderer.PrintImage(position, imageSelected);
            }
            else
            {
                StringRenderer.PrintFreeString(new FreeString(new XYPair(position.x, position.y),
                                                              $"Image: {imageName} not find", TextColor.Red, alignment: Alignment.LeftAligned));
            }
        }
Example #3
0
        public static void PrintMenuItem(MenuItem item, int currentRow, int middleColumn, int startColumn)
        {
            XYPair position;

            switch (item.alignment)
            {
            case Alignment.LeftAligned:
                position = new XYPair(startColumn, currentRow);
                break;

            case Alignment.Centered:
                position = new XYPair(middleColumn - item.itemName.Length / 2 - 1, currentRow);
                break;

            default:
                position = new XYPair(middleColumn * 2 - item.itemName.Length, currentRow);
                break;
            }
            StringRenderer.PrintFreeString(new FreeString(position, item.itemName));
        }
Example #4
0
 public void Print()
 {
     StringRenderer.PrintFreeString(this);
 }