home *** CD-ROM | disk | FTP | other *** search
- ' ──────────────────────────────────────────────────────────────────────────
- '
- ' F T E S T . B A S
- '
- ' Copyright (c) 1992 by Tony Martin
- '
- ' This simple program demonstrates some of the special characters in the
- ' font DEMO.VGF. You must have a VGA card and color VGA-capable monitor
- ' to run this demo. Also, make sure the file DEMO.VGF is around.
- '
- ' You will be able to see some of the interface possibilities available
- ' to you using the QBSCR and Font Builder combination. The font DEMO.VGF
- ' was created using the Font Builder software included with QBSCR. It
- ' contains the standard character set, plus some new interface-oriented
- ' characters. With these new characters, you can build such common
- ' interface gadgets as radio buttons, check boxes, disk (or other) icons,
- ' and boxes that have borders on the very edge (two types are provided
- ' here as examples, found in the routines Box and Box2).
- '
- ' You will also see how easy it is to remap the palette in text mode with
- ' the new rgbRGB% function, part of QBSCR. Feel free to change the three
- ' values in the rgbRGB% calls below to change the colors displayed on the
- ' screen. Make sure you look at the DEMO.VGF font using Font Builder so
- ' you can see how some of this was done. Some of these interface symbols
- ' use two character cells to make the symbol.
- '
- ' To run this program, use the following command to load QB:
- '
- ' QB FTEST.BAS /l QBSCR20
- '
- ' making sure the QBSCR20.QLB file is in the current directory. The
- ' program will then display two boxes and some interface items to look
- ' at. Once this is done, hit any key to exit. The program doesn't
- ' really do anything, though it would be fairly easy to add code to
- ' handle the mouse clicking buttons and check boxes on and off.
- '
- ' ──────────────────────────────────────────────────────────────────────────
-
- '$INCLUDE: 'qbscr.inc' Comes with QBSCR.
- '$INCLUDE: 'qb.bi' Comes with QuickBASIC.
-
- DECLARE SUB Box (x1%, y1%, x2%, y2%, fg%, bg%)
- DECLARE SUB Box2 (x1%, y1%, x2%, y2%, fg%, bg%)
-
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Increase the stack space available. YOU MUST DO THIS AS THE FIRST
- ' EXECUTABLE LINE OF YOUR PROGRAM IF YOU USE THE FONT ROUTINES.
- ' ──────────────────────────────────────────────────────────────────────────
- CLEAR , , 8192
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Load the demo font data.
- ' ──────────────────────────────────────────────────────────────────────────
- LoadVgaTextFont "DEMO.VGF"
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Give ourselves 16 background colors to play with.
- ' ──────────────────────────────────────────────────────────────────────────
- BlinkOff
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Adjust the palette to suit our (your) needs.
- ' ──────────────────────────────────────────────────────────────────────────
- PALETTE 1, rgbRGB%(0, 0, 1) ' Dark blue.
- PALETTE 2, rgbRGB%(3, 3, 2) ' Almost white, but slightly yellow.
- PALETTE 4, rgbRGB%(3, 1, 2) ' Hot pink, with a purple tinge.
- PALETTE 5, rgbRGB%(1, 0, 1) ' Dark purple.
- PALETTE 6, rgbRGB%(1, 2, 3) ' Nice medium to pale blue.
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Set dark blue as color for background.
- ' ──────────────────────────────────────────────────────────────────────────
- COLOR 0, 1
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Clear screen with dark blue.
- ' ──────────────────────────────────────────────────────────────────────────
- CLS
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Draw a box of the first type. This is a box with borders that go all the
- ' way to the edge, and are two pixels wide. This will be the screen border.
- ' ──────────────────────────────────────────────────────────────────────────
- Box 1, 1, 80, 25, 2, 1
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' This part should be fun! See if you can figure out what it does...
- ' ──────────────────────────────────────────────────────────────────────────
- COLOR 15, 1
- LOCATE 3, 5, 0
- PRINT STRING$(64, 216);
- FOR i% = 207 TO 215
- PRINT CHR$(i%);
- NEXT i%
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Some credits to demonstrate the copyright symbol.
- ' ──────────────────────────────────────────────────────────────────────────
- COLOR 15, 1
- Box2 24, 5, 57, 7, 15, 6
- LOCATE 6, 25, 0
- COLOR 0, 6
- PRINT "Copyright "; CHR$(233); " 1992 by Tony Martin";
-
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Draw a box of the first type. This is a box with borders that go all the
- ' way to the edge, and are two pixels wide. This will be the first box.
- ' ──────────────────────────────────────────────────────────────────────────
- Box 21, 9, 60, 15, 15, 4
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Add some interface items, in this case, three radio buttons and three
- ' check boxes.
- ' ──────────────────────────────────────────────────────────────────────────
- COLOR 0, 4
- LOCATE 10, 26, 0: PRINT CHR$(199); CHR$(225); " Button 1 "; CHR$(197); CHR$(224); " Check Box 1";
- LOCATE 11, 26, 0: PRINT CHR$(201); CHR$(226); " Button 2 "; CHR$(198); CHR$(227); " Check Box 2";
- LOCATE 12, 26, 0: PRINT CHR$(201); CHR$(226); " Button 3 "; CHR$(197); CHR$(224); " Check Box 3";
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Add three disk drive icons, two floppies and three hard disks.
- ' ──────────────────────────────────────────────────────────────────────────
- LOCATE 14, 27, 0: PRINT CHR$(204); CHR$(231); " A "; CHR$(204); CHR$(231); " B "; CHR$(205); CHR$(232); " C "; CHR$(205); CHR$(232); " D "; CHR$(205); CHR$(232); " E"
- COLOR 15, 0
- LOCATE 14, 26, 0: PRINT " "; CHR$(204); CHR$(231); " A "
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Draw a box of the second type. This is a box with borders that go all the
- ' way to the edge, and are only one pixel wide.
- ' ──────────────────────────────────────────────────────────────────────────
- COLOR 15, 1
- Box2 21, 17, 61, 21, 15, 5
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Add some text to the second box.
- ' ──────────────────────────────────────────────────────────────────────────
- COLOR 11, 5
- LOCATE 18, 22, 0: PRINT "This box can be drawn in with no top";
- LOCATE 19, 22, 0: PRINT "or bottom margin, but requires a left";
- LOCATE 20, 22, 0: PRINT "margin of 1 (1-char right to balance)";
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Wait for a user keypress before we clear everything and end.
- ' ──────────────────────────────────────────────────────────────────────────
- d$ = INPUT$(1)
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Reset the screen font to normal.
- ' ──────────────────────────────────────────────────────────────────────────
- LoadVgaTextFont ""
-
- ' ──────────────────────────────────────────────────────────────────────────
- ' Restore normal blinking attributes.
- ' ──────────────────────────────────────────────────────────────────────────
- BlinkOn
-
- COLOR 7, 0
- CLS
- END
-
- SUB Box (x1%, y1%, x2%, y2%, fg%, bg%)
-
- ' ────────────────────────────────────────────────────────────────────────
- ' This routine draws a box that has a border going all the way to the
- ' edges. The border is two pixels wide, and uses characters from the
- ' DEMO.VGF font to do it.
- ' ────────────────────────────────────────────────────────────────────────
-
- COLOR fg%, bg%
-
- ' ────────────────────────────────────────────────────────────────────────
- ' Draw the top row of the box.
- ' ────────────────────────────────────────────────────────────────────────
- LOCATE y1%, x1%, 0
- PRINT CHR$(218); STRING$(x2% - x1% - 1, 196); CHR$(195);
-
- ' ────────────────────────────────────────────────────────────────────────
- ' Draw the sides and interior of the box.
- ' ────────────────────────────────────────────────────────────────────────
- FOR i% = y1% + 1 TO y2% - 1
- LOCATE i%, x1%, 0
- PRINT CHR$(179); SPACE$(x2% - x1% - 1); CHR$(194);
- NEXT i%
-
- ' ────────────────────────────────────────────────────────────────────────
- ' Draw the bottom row.
- ' ────────────────────────────────────────────────────────────────────────
- LOCATE y2%, x1%, 0
- PRINT CHR$(192); STRING$(x2% - x1% - 1, 193); CHR$(217);
-
- END SUB
-
- SUB Box2 (x1%, y1%, x2%, y2%, fg%, bg%)
-
- ' ────────────────────────────────────────────────────────────────────────
- ' This routine draws a box that has a border going all the way to the
- ' edges. The border is one pixel wide, and uses characters from the
- ' DEMO.VGF font to do it.
- ' ────────────────────────────────────────────────────────────────────────
-
- ' ────────────────────────────────────────────────────────────────────────
- ' Draw the top row. It is compose of characters that look like the
- ' underscore (_) character. The last character is different. It is a
- ' single pixel, located in the lower-left corner of the character cell.
- ' It fills in a space of one pixel left by characters not lining up
- ' exactly. This is required, and you can remove the "CHR$(218);" part
- ' of the PRINT statement below to see the difference without it.
- ' ────────────────────────────────────────────────────────────────────────
- LOCATE y1%, x1%, 0
- PRINT STRING$(x2% - x1%, 203); CHR$(128);
-
- ' ────────────────────────────────────────────────────────────────────────
- ' Print the RIGHT side of the box using a special vertical character.
- ' ────────────────────────────────────────────────────────────────────────
- FOR i% = y1% + 1 TO y2% - 1
- LOCATE i%, x2%, 0
- PRINT CHR$(228);
- NEXT i%
-
- ' ────────────────────────────────────────────────────────────────────────
- ' Display the bottom row of the box. See the comment above about the top
- ' row. Remove the "CHR$(129);" part of the PRINT statement below to see
- ' the difference in the box without this one-pixel filler character.
- ' ────────────────────────────────────────────────────────────────────────
- LOCATE y2%, x1%, 0
- PRINT STRING$(x2% - x1%, 200); CHR$(129);
-
- ' ────────────────────────────────────────────────────────────────────────
- ' Draw the left side and interior of the box.
- ' ────────────────────────────────────────────────────────────────────────
- COLOR fg%, bg%
- FOR i% = y1% + 1 TO y2% - 1
- LOCATE i%, x1%, 0
- PRINT CHR$(228); SPACE$(x2% - x1% - 1);
- NEXT i%
-
- END SUB
-
-