8-Bit Software Online Conversion

Presentation Example #1 - Listing

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