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