' UNCLMICE.LST
' This file demonstrates 2 ways in which to load an UncleMouse .CURsor file.
' -----------------------------------------------------------------------------
DIM d1$(16)                   !DIMension array to hold MASK "grid" info.
DIM d2$(16)                   !DIMension array to hold DATA "grid" info.
'                              You ONLY need these for ROUTINE 2.
jail:
FILESELECT "\*.CUR","MOUSE???.CUR",file$
IF file$=""
  DEFMOUSE 0
  EDIT
ENDIF
' -----------------------|
OPEN "I",#1,file$
INPUT #1,dummy$           ! INPUT file identifier
'
IF dummy$<>"  ' Uncle Carl's Famous Mouse Maker ½Carl J. Hafner"
  ALERT 3,"|This is an INVALID |mouse CURsor file ! ",1," Abort ",lk%
  '
  CLOSE #1                ! REMEMBER to CLOSE the file !
  GOTO jail               ! Return to the fileselector.
ENDIF
' -----------------------------------------------------------------------------
' ALL of the information needed to CREATE the mouse is contained in a string
' on the second line of the .CUR file. It can be CREATED using JUST the
' following 3 lines of code.
' ----------------------|\/ ROUTINE 1
'
abc$=INPUT$(1,#1)         ! INPUT the first character of the string (contained
'                           on line 2 of the .CUR file) into abc$. This first
'                           character contains the length of the entire string.
abc%=ASC(abc$)            ! Return the ASCII code of this first (char) string.
mshape1$=INPUT$(abc%,#1)  ! INPUT the full length of the string (as determined
'                           by abc%) into mshape1$ .
'                           That's it ! You have a loaded mouse cursor !
'
' GOTO done               ! If you use THIS routine to load a mouse .CURsor
'                           you DON'T have to input the rest of the file.
'                           You can jump right to the end of the file by
'                           activating "GOTO done" .
'
' ----------------------|/\ ROUTINE 1
' -----------------------------------------------------------------------------
'
' The second half of the .CUR file contains the SAME information as that
' contained in the first routine's string. It is, however, stored (instead)
' as number values which can be read in individually. If you opt to use
' THIS routine you MUST STILL read past the previous routine to get to
' this part of the file (you probably knew that :-).
'
' ----------------------|\/ ROUTINE 2 \/
'
INPUT #1,hotx,hoty,mode,mcol,dcol    ! INPUT the "x hotspot", "y hotspot",
'                                      "mode" (normal or XOR), "mask color"
'                                      and "data color" of the cursor.
'
'                                      Now convert these values into
'                                      character strings, add them together
'                                \/    and assign them to mshape2$ .
'
mshape2$=MKI$(hotx)+MKI$(hoty)+MKI$(mode)+MKI$(mcol)+MKI$(dcol)
'
' ----------------------|
INPUT #1,dummy$                        ! The word "MASK" within the .CUR file.
'                                        The MASK is stored as 16 lines each
'                                        containing 16 characters (zeroes and
'                                        ones).
' ----------------------|
FOR tt=1 TO 16                         ! Start FOR loop.
  INPUT #1,d1$(tt)                     ! INPUT the 16 lines comprising the MASK
  '                                      into the d1$() array.
  mshape2$=mshape2$+MKI$(VAL("&X"+d1$(tt)))
NEXT tt
' "&X"+d1$(tt) gives the string a BINary format which VAL can recognize.
' If d1$(tt)="1111111111111111", VAL("&X"+"1111111111111111")=65535.
' VAL changes the character string ("&X"+d1$(tt)) into a number. /\
' MKI$ converts the resulting number VAL("&X"+d1$(tt)) into a character string.
' This character string is then added to mshape2$ .
' ----------------------|
INPUT #1,dummy$                        !The word "DATA" within the .CUR file.
'                                       The DATA is stored as 16 lines, each
'                                       containing 16 characters (zeroes and
'                                       ones).
' ----------------------|
FOR tt=1 TO 16
  INPUT #1,d2$(tt)
  mshape2$=mshape2$+MKI$(VAL("&X"+d2$(tt)))
NEXT tt
'                                       That's it ! You now have a new mouse !
' ---------------------|/\ ROUTINE 2 /\
done:
CLOSE #1
bill:
ALERT 2,"View mouse created with |mshape1$ or mshape2$..? ",1,"mouse1$|mouse2$|quit",lk%
IF lk%=1
  DEFMOUSE mshape1$
ELSE IF lk%=2
  DEFMOUSE mshape2$
ELSE
  DEFMOUSE 0
  EDIT
ENDIF
DO
LOOP UNTIL MOUSEK
DEFMOUSE 0
GOTO bill
