10 REM >Example2 20 REM by Steven Flintham 30 REM 40 REM Demonstrate one style of front end 50 REM (also includes some nice routines which you can "borrow"!) 60 REM 70 REM (C) Steven Flintham 1992 80 REM 90 REM Thursday 6th August 1992 100 REM Saturday 8th August 1992 110 : 120 PROCdisable 130 PROCinit 140 MODE 4 150 VDU 23;8202;0;0;0; 160 gxr%=FNgxr_present 170 MODE 4 180 VDU 23;8202;0;0;0; 190 VDU 19,0,7,0,0,0,19,1,0,0,0,0 200 PROCbox3d(16,892,1260,1004,0,1,"",32) 210 PROCexec("Bold0") 220 PROCbox3d(48,924,464,976,1,0,"Display demo",32) 230 PROCbox3d(980,924,1236,976,1,0,"Message",32) 240 PROCbox3d(16,16,1260,860,0,1,"",32) 250 PROCexec("NewFont") 260 PROCmessage 270 MODE 7 280 PROCenable 290 END 300 : 310 DEF PROCdisable 320 REM Disable the cursor and ESCAPE keys 330 *FX229,1 340 *FX4,2 350 ENDPROC 360 : 370 DEF PROCenable 380 REM Enable the cursor and ESCAPE keys 390 *FX229,0 400 *FX4,0 410 ENDPROC 420 : 430 DEF PROCinit 440 REM Initialise the program 450 ON ERROR MODE 7:REPORT:PRINT " at line ";ERL:PROCenable:END 460 ENDPROC 470 : 480 DEF PROCmessage 490 REM Print up a message in the main box pointing out how wonderful this 500 REM type of layout is 510 VDU 5 520 GCOL 0,0 530 MOVE 48,844 540 PRINT "This is an example of one form of" 550 MOVE 48,812 560 PRINT "screen layout." 570 MOVE 48,748 580 PRINT "Note the combination of three boxes" 590 MOVE 48,716 600 PRINT "in the heading - a background box and" 610 MOVE 48,684 620 PRINT "two 'title' boxes." 630 MOVE 48,620 640 PRINT "Try removing line 190 and see how the" 650 MOVE 48,588 660 PRINT "screen's appearance changes." 670 MOVE 48,524 680 PRINT "You can use the routines given here" 690 MOVE 48,492 700 PRINT "in your own private programs, and in" 710 MOVE 48,460 720 PRINT "any you release as public domain," 730 MOVE 48,428 740 PRINT "provided I get a mention in the" 750 MOVE 48,396 760 PRINT "documentation. You can NOT use these" 770 MOVE 48,364 780 PRINT "routines in a commercially released" 790 MOVE 48,332 800 PRINT "program without my permission!" 810 MOVE 430,64 820 PRINT "Press SPACE..." 830 VDU 4 840 *FX21 850 REPEAT UNTIL GET=32 860 ENDPROC 870 : 880 DEF FNgxr_present 890 REM This is a useful function which should be called just after a mode 900 REM change (it needs a blank screen) which returns TRUE if a GXR is 910 REM present (or it's running on a Master or above - which is the same 920 REM thing as far as GXR facilities are concerned). The screen mode should 930 REM be reselected afterwards as it corrupts the display slightly. 940 GCOL 0,7 950 REM Plot a circle using GXR commands (nothing will appear if it is not 960 REM present) 970 MOVE 640,512 980 PLOT &99,32,0 990 REM Return TRUE if the circle has been plotted - i.e., if there is a 1000 REM non-black pixel at the centre of the screen 1010 =(POINT(640,512)>0) 1020 : 1030 DEF PROCbox3d(bx%,by%,tx%,ty%,col1%,col2%,text$,hcp%) 1040 REM Plot a nice 3D box at the given coordinates. col1% and col2% are the 1050 REM colours to use and text$ (if not null) will be printed centrally in 1060 REM the "raised" part of the box. hcp% is only used if text is to be 1070 REM printed, and is the number of pixels per character, as follows: 1080 REM In mode 0, it is 16 1090 REM In modes 1 and 4, it is 32 1100 REM In modes 2 and 5, it is 64 1110 REM The global variable gxr% MUST be present for this to work. If it is 1120 REM TRUE, GXR functions will be used to speed up the drawing. If you 1130 REM don't want to use the detection routine, just set gxr% to FALSE. 1140 REM If any text is printed, the system is left in VDU 4 mode - if you had 1150 REM been using VDU 5, it must be reselected after this. 1160 LOCAL textx%,texty% 1170 GCOL 0,col1% 1180 IF gxr% THEN PROCrect_gxr(bx%,by%,tx%-8,ty%-8) ELSE PROCrect_nongxr(bx%,by%,tx%-8,ty%-8) 1190 GCOL 0,col2% 1200 PROCoutline_rect(bx%,by%,tx%-8,ty%-8) 1210 IF gxr% THEN PROCrect_gxr(bx%+8,by%+8,tx%,ty%) ELSE PROCrect_nongxr(bx%+8,by%+8,tx%,ty%) 1220 IF text$="" THEN ENDPROC 1230 GCOL 0,col1% 1240 VDU 5 1250 textx%=bx%+8+((tx%-(bx%+8))/2)-((LEN(text$)*hcp%)/2) 1260 texty%=by%+8+(((ty%-(by%+8))/2)+16) 1270 MOVE textx%,texty% 1280 PRINT text$; 1290 VDU 4 1300 ENDPROC 1310 : 1320 DEF PROCrect_gxr(bx%,by%,tx%,ty%) 1330 REM Draw a solid rectangle in the current colour using the GXR 1340 MOVE bx%,by% 1350 PLOT &65,tx%,ty% 1360 ENDPROC 1370 : 1380 DEF PROCrect_nongxr(bx%,by%,tx%,ty%) 1390 REM Draw a solid rectangle in the current colour using triangles 1400 MOVE bx%,by% 1410 MOVE tx%,by% 1420 PLOT 85,tx%,ty% 1430 MOVE bx%,ty% 1440 PLOT 85,bx%,by% 1450 ENDPROC 1460 : 1470 DEF PROCoutline_rect(bx%,by%,tx%,ty%) 1480 REM Draw an outline rectangle in the current colour 1490 MOVE bx%,by% 1500 DRAW tx%,by% 1510 DRAW tx%,ty% 1520 DRAW bx%,ty% 1530 DRAW bx%,by% 1540 ENDPROC 1550 : 1560 DEF PROCexec(fname$) 1570 REM Perform the equivalent of *EXEC on fname$ 1580 LOCAL chan% 1590 chan%=OPENIN(fname$) 1600 REPEAT 1610 VDU BGET #chan% 1620 UNTIL EOF #chan% 1630 CLOSE #chan% 1640 ENDPROC