home *** CD-ROM | disk | FTP | other *** search
- ;FNS library (C)1994 Reflective Images
- ;Example program
- ;By Stephen McNamara
- ;Please feel free to use any part of the program
- ; in whatever way you feel like
-
- ;Some constants for use when setting FNSPrefs
- #none=0
- #centred=%1
- #bold=%10
- #underline=%100
- #rightalign=%1000
-
- ;Set up a palette
- PalRGB 0,1,15,15,0
- For h=2 To 15
- PalRGB 0,h,h,h,h
- Next h
-
- ;Get a bitmap to print onto
- BitMap 0,320,200,4
-
- ;Go into blitz mode and set up a slice
- BLITZ
- Slice 0,44,320,200,$fff8,4,8,16,320,320
- Show 0
- Use Palette 0
-
- ;Set output to our bitmap
- Use BitMap 0
- BitMapOutput 0
-
- ;Draw a little box
- For x.w=10 To 319
- Line x,0,x-10,14,6
- Next x
-
- ;Install our font as number 1
- #font=1
- suc.l=InstallFNS(#font,?font_dat)
-
- ;If suc.l doesn't equal #font then an error occured
- If suc<>#font Then AMIGA : Request Str$(suc),"Bugger","Okay" : End
-
- BLITZ
- ;set font output to bitmap and adjust FNS
- ;clipping area To full BitMap size
- FNSOutput 0,1
-
- ;Set centred text ON and select colour number 15 for drawing with
- FNSPrefs #centred,15
-
- ;Print a title for the screen centred around x=160
- FNSPrint #font,160,0,"FNS Library Simple Demonstration"
-
- ;Print some left aligned text in the default font (font number 0)
- FNSPrefs #none,12
- FNSPrint 0,0,30,"Left aligned text!"
-
- ;Print some right aligned text WITHOUT changing font preferences
- FNSPrint 0,319,40,"Right aligned text!",#rightalign,12
-
- ;Print a string from an address, centred on the screen
- ;in bold and with colour changing!
- FNSPrint 0,160,60,?print_line,#centred|#bold,15
-
- FNSPrint #font,160,80,"Do you like my nice font printing?",#centred,1
-
- FNSPrint 0,160,110,"You can do....",#centred,15
- ;set preferences to bold and underline
- FNSPrefs #centred|#underline|#bold,12
- FNSPrint 0,160,120,"Centred, bold and underlined!"
-
- FNSPrint #font,160,140,"Its FAST and full CLIPPED!",#centred,1
-
- ;Set our tab spacing to 32 pixels
- FNSSetTab 32
- ;Set our preferences and ink colour
- FNSPrefs #none
- FNSInk 10
-
- ;Print font proportions
- ;Uses: ASCii 9 to aligned font proportions on a tab spacing
- ; ASCii 1 to signal text colour change
- ; ASCii 15 after ASCii 1 says to change colour to number 15
- FNSPrint 0,0,170,"FNSWidth : "+Chr$(9)+Chr$(1)+Chr$(15)+Str$(FNSWidth(1))
- FNSPrint 0,0,180,"FNSHeight: "+Chr$(9)+Chr$(1)+Chr$(15)+Str$(FNSHeight(1))
- FNSPrint 0,0,190,"FNSUnderline: "+Chr$(9)+Chr$(1)+Chr$(15)+Str$(FNSUnderline(1))
- MouseWait
- End
-
- INCDIR ""
- Even
-
- ;Incbin our font into the compiled file to save effort later
- font_dat: IncBin "FNS:Times15.FNS"
-
- ;A string to print that uses ASCii 1 to make the printing routines
- ;change output colour
- print_line:
- Dc.b "Th",1,14,"is ",1,13,"li",1,12,"ne ",1,11,"ch",1,10,"an",1,9
- Dc.b "ge",1,8,"s ",1,7,"CO",1,6,"LO",1,5,"UR",1,4,"!",0
-
- NPrint "Cudd"
-
-
-
-