Esempio n. 1
0
    public override void _Draw()
    {
        float squareSize = gameInstance.squareSize;

        for (int y = 0; y < sizeY; y++)
        {
            for (int x = 0; x < sizeX; x++)
            {
                if (grid[y, x] == 1)
                {
                    DrawRect(
                        new Rect2(
                            (x + posX) * squareSize, (y + posY) * squareSize,
                            squareSize, squareSize
                            ),
                        TetrominosTable.GetColor(colorIdx)
                        );
                }
            }
        }
        int boundsSizeX = (boundsMaxX - boundsMinX) + 1;
        int boundsSizeY = (boundsMaxY - boundsMinY) + 1;

        /*DrawRect(new Rect2(
         *  (posX + boundsMinX) * squareSize, (posY + boundsMinY) * squareSize,
         *  boundsSizeX * squareSize, boundsSizeY * squareSize
         *  ),
         *  new Color(.25f, 1f, .25f, .5f)
         * );*/
    }
Esempio n. 2
0
    public override void _Draw()
    {
        /*Transform2D t = GetTransform();
         * t.origin = currentPosition;
         * VisualServer.CanvasItemSetTransform(GetCanvasItem(), t);*/

        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                if (grid[y, x] != 0)
                {
                    DrawRect(
                        new Rect2(
                            x * squareSize, y * squareSize,
                            squareSize, squareSize
                            ),
                        TetrominosTable.GetColor(grid[y, x])
                        );
                }
            }
        }
    }