Exemplo n.º 1
0
    public static PenDownCrdinalFontShape newRandShape(int ply)
    {
        // ply is the number of shapes you want to add together
        // 1 ply => generate a random base shape
        // 2 ply => connect 2 random  base shapes
        // 3 ply => connect 3 random base shapes
        // etc...

        PenDownCrdinalFontShape resultShape = newRandShape();

        for (int i = 0; i < ply - 1; i++)
        {
            PenDownCrdinalFontShape newShape = newRandShape();
            Vector2Int offset = resultShape.getEndPoint.pos;
            int        tries  = 0;
            while (!CardionalFontValidator.validate(resultShape.getPoints, newShape.getPoints, offset))
            {
                // While the new shape is invalid
                if (tries >= 5)
                {
                    break;
                }                           // TODO: Fix this, it's bad design
                tries++;
                newShape = newRandShape();
            }
            resultShape.combine(newShape);
        }
        return(resultShape);
    }
Exemplo n.º 2
0
    public static PenDownCrdinalFontShape temp()
    {
        // Given a new character
        // Mash it into the existing character

        PenDownCrdinalFontShape baseShape = newUpRight();
        PenDownCrdinalFontShape newShape  = newRandShape();

        // TODO: Make the offset based on the shape not hardcoded
        Vector2Int offset = new Vector2Int(1, 1);
        int        tries  = 0;

        while (!CardionalFontValidator.validate(baseShape.getPoints, newShape.getPoints, offset))
        {
            // While the new shape is invalid
            if (tries >= 5)
            {
                break;
            }
            tries++;
            newShape = newRandShape();
        }
        return(baseShape.combine(newShape));
    }