Ejemplo n.º 1
0
                public static StackLine Parse(string line)
                {
                    StackLine res = new StackLine();

                    //Common part
                    string[] split = line.Split(' ');
                    res.Layer        = int.Parse(split[(int)Beginning.Layer]);
                    res.Size         = double.Parse(split[(int)Beginning.Size],CultureInfo.InvariantCulture);
                    res.CurrentShape = ShapeString.First(x => x.Value == split[(int)Beginning.Shape]).Key;
                    //Varying part
                    //res.Arguments = res.Arguments.Where(x => x.Indexes.ContainsKey(res.CurrentShape)).ToArray();
                    for (int i = 0; i < res.Arguments.Length; i++)
                    {
                        res.Arguments[i].Parse(res.CurrentShape,line);
                    }
                    return(res);
                }
Ejemplo n.º 2
0
        private static void CreateHoverUI()
        {
            HoverUI interfaccia = new HoverUI();

            var rect = new ShapeRectangle(0, 0, Color.OrangeRed, 50, 50);

            var color = new ShapeString(100, 100, Color.White, "Color: ");

            interfaccia.Render += (s, e) =>
            {
                color.Text = $"Color: {interfaccia.GetColorAtPixel(new Point(0, 0))}";

                int speed = 5;

                if (interfaccia.GetBackgroundKeyDown(Keys.Right))
                {
                    rect.X += speed;
                }
                if (interfaccia.GetBackgroundKeyDown(Keys.Left))
                {
                    rect.X -= speed;
                }

                if (interfaccia.GetBackgroundKeyDown(Keys.Up))
                {
                    rect.Y -= speed;
                }
                if (interfaccia.GetBackgroundKeyDown(Keys.Down))
                {
                    rect.Y += speed;
                }
            };

            interfaccia.AddShape(color);
            interfaccia.AddShape(rect);

            interfaccia.Run();
        }