Esempio 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);
            }
        }
Esempio n. 2
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);
        }