8-Bit Software Online Conversion

Creating user friendly programs (3) ----------------------------------- by Steven Flintham (15A) ------------------ The screen layout (3) --------------------- As mentioned in issue 22, in this article I will explain how to create an Impression-like display in your own programs. Unfortunately, a greyscale palette is required, and this is not available on the 8-bit BBC series. However, this limitation can be overcome in many cases. If you are using a monochrome monitor, for once you have a real advantage over users of colour systems, because the standard colours appear as greyscales on such a display. Similarly, if you have a colour TV as a display, you can turn down the colour control to obtain a similar effect. Owners of colour monitors are out of luck, and if you are in this position and want to see the effect, you will have to print out the screens or connect a television - or carry out the modifications mentioned in the June 1987 edition of The Micro User, although this seems a little drastic! This article is accompanied by two demonstration programs, both of which produce the same display. 3DDemo is the "full" version, which is SLIGHTLY too long to run on some machines without shadow RAM (the 3D effect uses mode 1) - it will run on a BBC B+ or Master, and possibly on some BBC B's with low values of PAGE. 3DDemoS is manually crunched to be reasonably intelligible and run on all machines. If you want to use the routines in your own programs, I suggest that you take them from the full 3DDemo program, whichever machine you use, and crunch them using a cruncher if necessary. Only the full program is documented here, but this should not present a problem. PROCinitialise first checks for the presence of a GXR or equivalent using the routine from the first article in this series. It then redefines the palette to give a greyscale effect on a monochrome display. The "COLOUR" statements which have been REMmed out show my suggested values for the red, green and blue components of the colours if you are running the program on an Archimedes, or if you have a palette extension board of some kind, in which case you will have to modify this part of the program. The pageX procedures are of no significance in themselves - they merely call the 3D routines to produce the demonstration screens. They may, however, help to clarify the description of the routines given below. PROCspace and PROCtitle also just call the 3D routines. PROCrectangle and PROCoutline#rect are self-explanatory, and are the same as those from the first part of this series. The 3D routines themselves -------------------------- PROCdraw#outline#box(bx%,by%,tx%,ty%,ab solute%,title$) This draws an outline box. bx%,by% determines the position of the bottom left corner of the box. If absolute% is TRUE, tx%,ty% determines the position of the upper right corner. If absolute% is FALSE, tx% and ty% determine the x and y sizes respectively, and will be added to bx% and by% to give the coordinates of the upper right corner. If title$ is not null (i.e. not ""), a 3D slab will be placed at the top right of the outline box containing title$. This will have its size determined automatically. PROCdraw#3d#box(bx%,by%,tx%,ty%,absolut e%,in%) This draws a 3D slab. See the description of PROCdraw#outline#box above for an explanation of bx%,by%,tx%,ty% and absolute%. in% determines whether the slab is raised or lowered - if it is TRUE, the slab will be lowered, i.e. set "into" the screen, while setting it to FALSE will make the slab "stand out". PROCdraw#3d#box#with#centre(bx%,by%,tx% ,ty%,absolute%,in%) This works in exactly the same way as PROCdraw#3d#box, and the input parameters are identical. The only difference is that this also draws a white "box" in the centre of the slab, as illustrated on the third example screen. PROCplace#text#centred#in#3d#box(bx%,by %,tx%,ty%,absolute%,text$,col%) This places text in the centre of a 3D slab - whether or not it has a white centre. The bx%,by%,tx%,ty% and absolute% parameters should be the SAME as those used when creating the slab - they determine the area in which the text is to be centred. text$ is the text to be printed, and col% is the colour to be used. I hope that's clear enough. As always, you are free to use these routines in your own programs provided that you don't sell them for profit and (if possible) I get a mention!