' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.10.26.02.14]) on 2023.11.04 at 17:15 (Coordinated Universal Time) _TITLE "BAM Draw" ' Program by Charlie Veniot DIM 🖥w% = 0, 🖥h% = 0 🔁drawing_cycle: GOSUB ♻do_refresh temp$ = INKEY$ IF temp$ <> "" THEN brush$ = temp$ IF _MOUSEBUTTON AND BETWEEN(_MOUSEX,0,XMAX) AND BETWEEN(_MOUSEY, 0, YMAX - 16) THEN _ x% = _MOUSEX : _ y% = _MOUSEY : _ GOSUB 🎨do_brush_stroke GOTO 🔁drawing_cycle END 🔳do_grid: IF MAX(1, GetLocalStorageItem( "draw:grid" ) ) THEN FOR i = 0 TO xMAX STEP 8 LINE (i,0) TO (i,(yMAX-16)), 7 NEXT i FOR i = 7 TO (yMAX-16) STEP 8 LINE (0,i) TO (xMAX,i), 7 NEXT i END IF RETURN 🎨do_brush_stroke: new_y = FIX(y%/8)+1 : new_x = FIX(x%/8)+1 f_color = 15 : b_color = 0 LOCATE new_y, new_x : PRINT brush$; GOSUB 🔳do_grid SetLocalStorageItem( "draw:stroke:" + new_y + "," + new_x, brush$ + " " + f_color + "," + b_color) RETURN 📐do_canvas_resize: IF 🖥w% <> MAX(64, GetLocalStorageItem( "draw:width" ) * 8 ) _ OR 🖥h% <> MAX(64, GetLocalStorageItem( "draw:height" ) *8 ) _ THEN LET 🖥w% = MAX(64, GetLocalStorageItem( "draw:width" ) * 8 ) LET 🖥h% = MAX(64, GetLocalStorageItem( "draw:height" ) * 8 ) SCREEN _NEWIMAGE( 🖥w%, 🖥h%, 7 ) GOSUB 🔳do_grid END IF RETURN ♻do_refresh: GOSUB 📐do_canvas_resize RETURN