' This program exported from BASIC Anywhere Machine (Version [5.2.3].[2023.12.16.16.28]) on 2023.12.29 at 19:58 (Coordinated Universal Time)
' Program by Charlie Veniot
' 

_ALERT("Scroll wheel forward to increase the size of the shape.\n" + _
       "Scroll wheel backward to decrease the size of the shape.\n"+ _
       "Click on the screen to move the shape that direction.\n"+ _
       "The shape's outer edges cannot go beyond the edges of the screen." )

' 🟢 INITIALIZATION

  E% = 200 : E_X% = E% : E_Y% = E%
  R% = 50 : RMIN% = 10 : T% = 10 : AINC% = 360
  SCREEN _NEWIMAGE(E%*2+1,E%*2+1,12)

' 🟢 MAIN PROGRAM

🔁StartCycle:

  GOSUB 🎨_DrawShape
  
  GOSUB 🔆_HandleMouseButton
  
  GOSUB 🛞_HandleMouseWheel

GOTO 🔁StartCycle

' 🟢 SUBROUTINES

🎨_DrawShape: 
  CLS
  CIRCLE (E_X%, E_Y%), R%, , , , ,T
  CIRCLE (E_X%, E_Y%), R%+T%+1, , , , ,T

  AINC% = AINC%⁣-⁣1 : IF AINC% <= 0 THEN AINC% = 360

  FOR A% = 0+AINC% TO 360+AINC%  STEP 90
      PRESET (E_X%,E_Y%)
      DRAW "B TA " + A% + " U" + R%
      DRAW "C 15 TA " + A% + " U" + T%
  NEXT A%

  C% = 14
  FOR A% = 45+AINC% TO 405+AINC% STEP 90
      PRESET (E_X%,E_Y%)
      DRAW "B TA " + A% + " U" + INT((R% + 2))
      PAINT (POINT(0),POINT(1)), C%, 15
      C% = IFF(C%=14,1,14)
  NEXT A%

  _DISPLAY

RETURN
  
🔆_HandleMouseButton:

  IF _MOUSEBUTTON  _
     THEN
         IF E_X% <> _MOUSEX _
            THEN E_X% = E_X% _
                        + IFF(_MOUSEX > E_X%, _
                              IFF( [E_X%+R%+T%+5] < XMAX, 1, 0), _
                              IFF( [E_X%⁣-⁣R%⁣-⁣T%⁣-⁣5] >    0, ⁣-⁣1, 0 ) )
         IF E_Y% <> _MOUSEY _
            THEN E_Y% = E_Y% _
                        + IFF(_MOUSEY > E_Y%, _
                              IFF( [E_Y%+R%+T%+5] < YMAX, 1, 0), _
                              IFF( [E_Y%⁣-⁣R%⁣-⁣T%⁣-⁣5] >    0, ⁣-⁣1, 0 ) )
  END IF ' _MOUSEBUTTON
                              
RETURN
  
🛞_HandleMouseWheel:

  MW% = _MOUSEWHEEL
  IF MW% < 0 AND E_X%>=0+R%+T%+5 AND E_Y%>=0+R%+T%+5 AND E_X%<=XMAX⁣-⁣R%⁣-⁣T%⁣-⁣5 AND E_Y%<=YMAX⁣-⁣R%⁣-⁣T%⁣-⁣5 THEN R% = R% + 5
  IF MW% > 0 THEN R% = MAX(R% ⁣-⁣ 5, RMIN%)
  
RETURN