Exit Full View
Up

/Games/ExampleJigsaw.foocad

ExampleJigsaw

An example of how to use Jigsaw.feather.

FooCAD Source Code
import static uk.co.nickthecoder.foocad.chamferedextrude.v1.ChamferedExtrude.*

include Jigsaw.feather

class ExampleJigsaw : Model {

    fun makeJigsaw() = Jigsaw(
        Square(200,150).color("White"),
        Text( "Hello\nWorld", TextStyle( BOLD, 44f ).hAlign( HAlignment.CENTER ) ).centerTo(100,75).color("Blue"),
        Circle( 40 ).centerTo( 100, 75 ).color("Red"),
        4, 3
    )

    @Piece
    fun debug() : Shape3d {
        val jigsaw = makeJigsaw()
        return jigsaw.cut()
    }

    override fun build() : Shape3d {
        
        val jigsaw = makeJigsaw()
        jigsaw.cut()
        return jigsaw.build(0,11, 3)
        
    }
}