Ejemplo n.º 1
0
        private void panelPatchContainer_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            for (int w = 0; w < ConfigManager.Instance.Width; w++)
            {
                for (int h = 0; h < ConfigManager.Instance.Height; h++)
                {
                    g.DrawEllipse(new Pen(Color.Black, 1), zoom + 2 * w * zoom - zoom / 2, zoom + 2 * h * zoom - zoom / 2, zoom, zoom);
                }
            }

            if (!startPosition.Equals(currentPosition))
            {
                bool isHit = false;
                foreach (PatchItem p in PatchManager.Instance.Patches)
                {
                    isHit = isHit || p.IsHit(startPosition, currentPosition);
                }
                if (!isHit)
                {
                    PatchItem.Draw(g, startPosition.ToPanelXY(zoom), currentPosition.ToPanelXY(zoom), zoom);
                }
            }

            foreach (PatchItem p in PatchManager.Instance.Patches)
            {
                p.Draw(g, zoom);
            }
        }
Ejemplo n.º 2
0
        private void buttonSavePatch_Click(object sender, EventArgs e)
        {
            if (selectedPatch == null)
            {
                PatchItem p = new PatchItem();
                p.x      = startPosition.X;
                p.y      = startPosition.Y;
                p.length = (currentPosition.X - startPosition.X + currentPosition.Y - startPosition.Y);
                if (p.length > 0)
                {
                    p.length++;
                }
                else
                {
                    p.length--;
                }
                p.direction    = (currentPosition.X != startPosition.X);
                p.universe     = byte.Parse(textBoxUniverse.Text);
                p.startChannel = int.Parse(textBoxStartChannel.Text);

                PatchManager.Instance.Patches.Add(p);
                ConfigManager.Instance.Save();

                buttonCancel_Click(sender, e);
            }
        }
Ejemplo n.º 3
0
 private void buttonCancel_Click(object sender, EventArgs e)
 {
     buttonAddPatch.Visible    = true;
     buttonCancel.Visible      = false;
     currentStatus             = MouseStatus.selecting;
     selectedPatch             = null;
     groupBoxPatchInfo.Visible = false;
     startPosition             = currentPosition = new Point(-1, -1);
     panelPatchContainer.Refresh();
 }
Ejemplo n.º 4
0
        public void Draw(Graphics g, int zoom)
        {
            Point p = (new Point(x, y)).ToPanelXY(zoom);

            PatchItem.Draw(g, p, new Point(p.X + 2 * zoom * (direction ? Math.Sign(length) * (Math.Abs(length) - 1) : 0), p.Y + 2 * zoom * (!direction ? Math.Sign(length) * (Math.Abs(length) - 1) : 0)), zoom);
        }