' iBChristmas.ibas
{CREATORID "LDXM"}
{VERSION "1.1"}
{RESOURCEFILE "iBChristmas.rsrc"}

BEGIN
  S=SCREENMODES
  IF S<3 THEN
    M=MESSAGEBOX("Sorry, a color device is required.",0)
  ELSE
    S$=GETOSVER$ : S=VAL(S$)
    GOSUB _AllOK
  ENDIF
END

_AllOK:
  SETFONT 1
  BUTTON #1,"i",149,1,10,10
  SETFONT 0
  I=1 : C=COLOR(0)
  T=TICKS
  REPEAT
    E=DOEVENTS
      IF E=1 M=NOTICEBOX(1)
      IF E=1000 LET P=PENDOWN : IF P=0 LET I=I+1 : COLOR C : BOXFILLED 16,18 TO 143,160 : T=T-50 : IF I=3 LET I=1
      N=TICKS-T : IF N>50 LET T=TICKS : GOSUB _Animate
  UNTIL E=-1
RETURN

_Animate:
    J=J+1 : IF J=4 LET J=1
    K=I*10+J
    IF I=1 THEN
      IMAGE K,28,18
    ELSE
      IMAGE K,16,43
    ENDIF
    IF S>=5 LET F=TICKS-G : IF F>1000 LET G=TICKS : PLAYWAVE 1,1024,1
RETURN