Ejemplo n.º 1
0
    public override void activate(int ex, int ey)
    {
        pixelGridPanel.toolGrid.clear(RGB.nullRGB);
        int gx = pixelGridPanel.gridPixelX(ex);
        int gy = pixelGridPanel.gridPixelY(ey);

        if (gx >= 0 && gx < pixelGridPanel.ActiveGrid.Size.x &&
            gy >= 0 && gy < pixelGridPanel.ActiveGrid.Size.y)
        {
            foreach (Vector v in PixelGridPanel.getPixelsInBetween(
                         pixelGridPanel.gridPixelX(ex),
                         pixelGridPanel.gridPixelY(ey),
                         pixelGridPanel.gridPixelX(pixelGridPanel.lastMousePosition.x),
                         pixelGridPanel.gridPixelY(pixelGridPanel.lastMousePosition.y),
                         0.2f
                         ))
            {
                pixelGridPanel.toolGrid.setPixel(
                    v.x,
                    v.y,
                    pixelGridPanel.drawColor
                    );
            }
        }
        pixelGridPanel.Invalidate();
    }
Ejemplo n.º 2
0
    protected override bool canFillPixel(int gx, int gy, RGB fromRGB, RGB toRGB)
    {
        bool canFill = base.canFillPixel(gx, gy, fromRGB, toRGB);

        if (!canFill)
        {
            return(false);
        }
        //Return true if not required to check line of sight
        if (!checkLOS)
        {
            return(true);
        }
        //Exit if there's no line of sight to beginning
        foreach (Vector v in PixelGridPanel.getPixelsInBetween(
                     fillSparkPos.x,
                     fillSparkPos.y,
                     gx,
                     gy,
                     0.4f
                     ))
        {
            RGB rgb = pixelGridPanel.ActiveGrid.getPixel(v.x, v.y);
            if (v.x != gx || v.y != gy)
            {
                if (rgb != fromRGB && rgb != toRGB)
                {
                    return(false);
                }
            }
        }
        return(true);
    }
Ejemplo n.º 3
0
 public Tool(PixelGridPanel pixelGridPanel)
 {
     this.pixelGridPanel = pixelGridPanel;
 }
Ejemplo n.º 4
0
 public HandTool(PixelGridPanel pgp) : base(pgp)
 {
     pixelGridPanel.MouseDown += overtakeMouseDown;
 }
Ejemplo n.º 5
0
 public FillTool(PixelGridPanel pgp) : base(pgp)
 {
 }
Ejemplo n.º 6
0
 public LineTool(PixelGridPanel pgp) : base(pgp)
 {
 }
Ejemplo n.º 7
0
 public LightBulbFillTool(PixelGridPanel pgp) : base(pgp)
 {
 }
Ejemplo n.º 8
0
 public PencilTool(PixelGridPanel pgp) : base(pgp)
 {
 }