Example #1
0
    public QRCode(QRDimensionBridge main, PixelGrouper pixelGrouper, QRSquare square)
    {
        this.main         = main;
        this.pixelGrouper = pixelGrouper;

        this.squares = new List <QRSquare>();
        this.squares.Add(square);
    }
    public QRDimensionBridge(QRHandler main, PixelGrouper pixelGrouper)
    {
        this.main         = main;
        this.pixelGrouper = pixelGrouper;

        GenerateQRCodes();
        Generate3DMap();
    }
Example #3
0
    public void GetConnectedPixels(PixelGrouper grouper, PixelSquare pixelSquare)
    {
        List <Pixel> connectedPixels = new List <Pixel>();
        Pixel        foundPixel;

        if (grouper.PixelMap.TryGetValue(position + new Vector2(-1, 0), out foundPixel))
        {
            connectedPixels.Add(foundPixel);
        }

        if (grouper.PixelMap.TryGetValue(position + new Vector2(1, 0), out foundPixel))
        {
            connectedPixels.Add(foundPixel);
        }

        if (grouper.PixelMap.TryGetValue(position + new Vector2(0, -1), out foundPixel))
        {
            connectedPixels.Add(foundPixel);
        }

        if (grouper.PixelMap.TryGetValue(position + new Vector2(0, 1), out foundPixel))
        {
            connectedPixels.Add(foundPixel);
        }

        pixelSquare.AddPixel(this);
        this.color = pixelSquare.Color;

        //Spread :P
        if (connectedPixels.Count > 0)
        {
            isCorner = connectedPixels.Count <= 2;

            foreach (Pixel pixel in connectedPixels)
            {
                if (!pixelSquare.colided(pixel.position))
                {
                    pixel.GetConnectedPixels(grouper, pixelSquare);
                }
            }
        }
    }