Tester: DRAW commands A and TA

Charlie VeniotΒ 22nd October 2022 at 10:45pm
' Test the DRAW statement's A and TA drawing commands
' CURRENTLY ONLY IMPLEMENTED TO WORK WITH THE TESTED DRAWING COMMANDS R,U,L,D and E,F,G,H.

DECLARE FUNCTION GetRndCol$()
base_colors$ = "010203040506091011121314"
DIM AS INTEGER a
SCREEN 12
l = 180
DEF FND$(g$,gc$) = "C" + gc$ + " N TA" + STR$(a) + g$ + STR$(l)

_ALERT("NOTE: At any time and as often as you like, you can refresh the random colors used for the graphics in this program.\n\nClick on (or touch) the screen just long enough for the program to catch the click/touch, and the colors will be changed.")

🟠🟠🟠BEGIN:

GOSUB pick_random_colors

DO
    FOR a = 0 TO 40 STEP 4
		  DRAW (FND$("r",grc$)) : DRAW (FND$("e",gec$))
		  DRAW (FND$("u",guc$)) : DRAW (FND$("h",ghc$))
		  DRAW (FND$("l",glc$)) : DRAW (FND$("g",ggc$))
		  DRAW (FND$("d",gdc$)) : DRAW (FND$("f",gfc$))
        GETMOUSE mx,my,mw,mb : IF mb = 1 THEN change_colors = TRUE
        _DISPLAY : SLEEP 0.125
    NEXT a
    GOSUB swap_colors
    IF change_colors = TRUE THEN GOSUB pick_random_colors : change_colors = FALSE
LOOP

END '🟠🟠🟠

' 🟑🟑🟑 Functions and subroutines

pick_random_colors:
    colors$ = base_colors$
	 grc$ = GetRndCol$() : gec$ = GetRndCol$()
	 guc$ = GetRndCol$() : ghc$ = GetRndCol$()
	 glc$ = GetRndCol$() : ggc$ = GetRndCol$()
	 gdc$ = GetRndCol$() : gfc$ = GetRndCol$()
RETURN

swap_colors:
    SWAP grc$, gec$ : SWAP grc$, guc$ : SWAP grc$, ghc$ : SWAP grc$, glc$
    SWAP grc$, ggc$ : SWAP grc$, gdc$ : SWAP grc$, gfc$
RETURN

FUNCTION GetRndCol$()
    color_id$ = MID$(colors$, INT(RND*(LEN(colors$)/2))*2 + 1 , 2)
    colors$ = REPLACE$(colors$, color_id$, "")
    GetRndCol$ = color_id$
END FUNCTION