Click here to download some
example code to help you get the jist.
One of the reasons why people feel the need to use a graphics lib is avail of the cool print routine. If you havn't used one before, imagine the benifits of a program that would allow you to position your text at any position on the screen without that ugly black box in the background! There are quite a lot of posibilities for such an feature - but say you don't want to use a lib - how do you go around making your own print routine? Oddly enough, it's remarkably easy.
Think about it. What is a letter except a group of pixels thrown together? Have a look at this picture :
Recognise it? It's the letter A of course! But it should show up exactly how the letter A is made up. In fact, all letters in the Character Set are just 8x8 images. If they are just images, then surely you can hold them in arrays like regular images! Yes you can! And because the letters are so small, they is practically no delay is using PSET to display the letters. And that's all a Print routine is. To program this, There a few simple steps that you should follow.
First of all, you'll want to store the letters. Decide which ones you'll want to store (You might have no need of the characters after CHR$(128), for example). Because we're going to be PSETing the pixels, you'll need an entire array of 64 elements for each character, or simply a multideminsional array to hold all the letters.
The next step is to load the characters into the array. You can do this by simply displaying the characters on screen and POINTing them into the array. Font1.bas in the included file shows you how to do this.
Now you should save the array. This is done in font2.bas.
Finally, you need to program a routine to display the characters onscreen again. Font3.bas shows you how.
That's your print routine. But how about changing the font? Simply change the contents of the array. You could write your own program to do this, of simply use the editor.exe, suplied in the zip file.
Also in the zip file is a font I've made by slightly distorting the letters - itallic.fnt. You can use this in your programs if you wish (As long as you give credit!)
So that's it! Honestly! It might seem like a complex operation, but there's no more to it than I've shown.