Creating user friendly programs (3) ----------------------------------- by Steven Flintham (15A) ------------------ The screen layout (3) --------------------- As mentioned in issue 22, in thisarticle I will explain how to create anImpression-like display in your ownprograms. Unfortunately, a greyscalepalette is required, and this is notavailable on the 8-bit BBC series.However, this limitation can beovercome in many cases. If you areusing a monochrome monitor, for onceyou have a real advantage over users ofcolour systems, because the standardcolours appear as greyscales on such adisplay. Similarly, if you have acolour TV as a display, you can turndown the colour control to obtain asimilar effect. Owners of colourmonitors are out of luck, and if youare in this position and want to seethe effect, you will have to print outthe screens or connect a television -or carry out the modificationsmentioned in the June 1987 edition ofThe Micro User, although this seems alittle drastic! This article is accompanied by twodemonstration programs, both of whichproduce the same display. 3DDemo is the"full" version, which is SLIGHTLY toolong to run on some machines withoutshadow RAM (the 3D effect uses mode 1)- it will run on a BBC B+ or Master,and possibly on some BBC B's with lowvalues of PAGE. 3DDemoS is manuallycrunched to be reasonably intelligibleand run on all machines. If you want touse the routines in your own programs,I suggest that you take them from thefull 3DDemo program, whichever machineyou use, and crunch them using acruncher if necessary. Only the fullprogram is documented here, but thisshould not present a problem. PROCinitialise first checks for thepresence of a GXR or equivalent usingthe routine from the first article inthis series. It then redefines thepalette to give a greyscale effect on amonochrome display. The "COLOUR"statements which have been REMmed outshow my suggested values for the red,green and blue components of thecolours if you are running the programon an Archimedes, or if you have apalette extension board of some kind,in which case you will have to modifythis part of the program. The pageX procedures are of nosignificance in themselves - theymerely call the 3D routines to producethe demonstration screens. They may,however, help to clarify thedescription of the routines givenbelow. PROCspace and PROCtitle alsojust call the 3D routines. PROCrectangle and PROCoutline#rect areself-explanatory, and are the same asthose from the first part of thisseries. The 3D routines themselves -------------------------- PROCdraw#outline#box(bx%,by%,tx%,ty%,absolute%,title$) This draws an outline box. bx%,by%determines the position of the bottomleft corner of the box. If absolute% isTRUE, tx%,ty% determines the positionof the upper right corner. If absolute%is FALSE, tx% and ty% determine the xand y sizes respectively, and will beadded to bx% and by% to give thecoordinates of the upper right corner. If title$ is not null (i.e. not ""), a3D slab will be placed at the top rightof the outline box containing title$.This will have its size determinedautomatically. PROCdraw#3d#box(bx%,by%,tx%,ty%,absolute%,in%) This draws a 3D slab. See thedescription of PROCdraw#outline#boxabove for an explanation ofbx%,by%,tx%,ty% and absolute%. in%determines whether the slab is raisedor lowered - if it is TRUE, the slabwill be lowered, i.e. set "into" thescreen, while setting it to FALSE willmake the slab "stand out". PROCdraw#3d#box#with#centre(bx%,by%,tx%,ty%,absolute%,in%) This works in exactly the same way asPROCdraw#3d#box, and the inputparameters are identical. The onlydifference is that this also draws awhite "box" in the centre of the slab,as illustrated on the third examplescreen. PROCplace#text#centred#in#3d#box(bx%,by%,tx%,ty%,absolute%,text$,col%) This places text in the centre of a 3Dslab - whether or not it has a whitecentre. The bx%,by%,tx%,ty% andabsolute% parameters should be the SAMEas those used when creating the slab -they determine the area in which thetext is to be centred. text$ is thetext to be printed, and col% is thecolour to be used. I hope that's clear enough. As always,you are free to use these routines inyour own programs provided that youdon't sell them for profit and (ifpossible) I get a mention!