Example #1
0
        public Field(int width, int height, SimpleShader simpleShader) : base(simpleShader)
        {
            Width            = width;
            Height           = height;
            EmploymentMatrix = new EmploymentMatrix(Width, Height);


            List <Vector2> vertices = new List <Vector2>();

            for (int i = 0; i <= Height; i += (int)Delta)
            {
                vertices.AddRange(Line(new Vector2(0, i), new Vector2(Width, i), 1f));
            }

            for (int i = 0; i <= Width; i += (int)Delta)
            {
                vertices.AddRange(Line(new Vector2(i, 0), new Vector2(i, Height), 1f));
            }
            Shape = vertices.ToArray();
            InstasingList.Add(new VisualUniforms(Color.LightGray));

            CrossCursor = new CrossCursor(simpleShader);



            SelectRectangle = new DrawingVisual(simpleShader);
            SelectRectangle.InstasingList.Add(new VisualUniforms(new Color4(0, 0, 0.5f, 0.2f)));
            SelectRectangle.IsVisible = false;
            Childrens.Add(SelectRectangle);
        }
Example #2
0
        public void MouseMove(Vector2 mouseFieldPos)
        {
            return;

            var newPos = ToDiscret(mouseFieldPos);

            if (SelectRectangle.IsVisible)
            {
                var size = newPos - SelectRectangle.Translate;
                SelectRectangle.Shape = GetFillRectangle(new Vector2(0, 0), size.X, size.Y, 0.5f);
            }
            if (_dragStreamingVisual != null)
            {
                _dragStreamingVisual.MouseMovePos = newPos;
            }
            if (_wireCreator != null)
            {
                _wireCreator.MouseMovePos = newPos;
            }

            bool hit = false;

            foreach (var streamingVis in StreamingComponents)
            {
                if (!streamingVis.Hit(mouseFieldPos))
                {
                    continue;
                }
                int pin;
                if (streamingVis.MouseSelectInput(newPos, out pin) ||
                    streamingVis.MouseSelectOutput(newPos, out pin))
                {
                    hit = true;
                    break;
                }
            }
            CrossCursor.OnPin = hit;


            CrossCursor.Animation("Translate", newPos, 50);
        }
Example #3
0
 public override void Draw()
 {
     base.Draw();
     CrossCursor.Draw();
 }