# Circles — Draws circles

Here is an example program for drawing circles or ellipses, filled or unfilled:

        PROC draw:
              LOCAL d%
              DO
                    dINIT "Draw a circle or an ellipse?"
                    dBUTTONS "Circle",%c OR $200,"Ellipse",%e OR $200,"Cancel",-27
                    d%=DIALOG
                    IF d%=%c
                          circle:
                    ELSEIF d%=%e
                          ellipse:
                    ENDIF
              UNTIL d%=0
        ENDP

        PROC circle:
              LOCAL x&,y&,r&,f%
              dINIT "Drawing parameters"
              x&=320 :dLONG x&,"Centre x position",0,639
              y&=120 :dLONG y&,"Centre y position",0,249
              r&=20 :dLONG r&,"Radius",1,320
              f%=0 :dCHECKBOX f%,"Filled"
              dBUTTONS "Draw",%d,"Cancel",-27
              IF DIALOG
                    gAT x&,y&
                    gCIRCLE r&,f%
                    GET
                    gCLS
              ENDIF
        ENDP

        PROC ellipse:
              LOCAL x&,y&,hr&,vr&,f%
              dINIT "Drawing parameters"
              x&=320 :dLONG x&,"Centre x position",0,639
              y&=120 :dLONG y&,"Centre y position",0,249
              hr&=20 :dLONG hr&,"Horizontal Radius",1,320
              vr&=20 :dLONG vr&,"Vertical Radius",1,320
              f%=0 :dCHECKBOX f%,"Filled"
              dBUTTONS "Draw",%d,"Cancel",-27
              IF DIALOG
                    gAT x&,y&
                    gELLIPSE hr&,vr&,f%
                    GET
                    gCLS
              ENDIF
        ENDP