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