| Note: These tutorials and FAQs are not meant for the beginner. A firm grasp of QuickBasic or VisualBasic is recommended before trying to understand these resources. Also, due to the complexity of some of the math presented, the minimum math needed for understanding is trigonometry. |
| TOPIC | Language | DECRIPTION |
| Math Calculations | QB, VB | explains the basics behind the use of INTEGERS instead of floating-point numbers to increase the speed of programs; also explains the integer divide the use of premade tables for cosine and sine, and why factoring makes the math more efficient |
| Poke and Peek | QB | explains the use of POKE and PEEK over PSET and POINT and tells when PSET should be used; also tells how to use the INTEGER for POKEing in screen 13H instead of the long integer memory segments for graphics, text, and ASCII are also explained |
| Palette | QB | covers PALETTE USING and accessing the PALETTE through hardware ports using the OUT and INP statements to make the palette change fast enough for palette rotation |
| Debabelizing | QB, VB | explains how to bring a picture from true-color and high resolution to 8-bit color and lower resolution for screen 13H (the way Donkey Kong Country was made for the SuperNES) |
| Sprites | QB | explains how to make transparent sprites (black is not shown) that are quickly drawn to overlap the existing graphics and why GET and PUT aren't always the best option for sprites (but their image storage format is important). |
| Double Buffering | QB | explains how to use GET-PUT arrays to double-buffer graphics in SCREEN 13H. and covers POKEing directly into the array, then using PUT to display the final product. |
| BLOAD and BSAVE | QB, VB | explains how to use BLOAD and BSAVE for fast loading and saving of files |
| I. How do I load and save a palette? - QB | ||||||
|
Actually, this depends on the file format. Most people use palettes stored in 768 element STRINGs. For this format, one would do the following: Saving: DEF SEG = VARSEG(pal) OUT &h3c7, 0 FOR col% = 0 to 767 POKE VARPTR(pal)+col%, INP(&h3c9) NEXT BSAVE "FileName.pal", VARPTR(pal), 767 Loading: DIM pal AS STRING *768 DEF SEG = VARSEG(pal) BLOAD "FileName.pal", VARPTR(pal) OUT &h3c8, 0 FOR col% = 0 to 767 OUT &h3c9, PEEK (VARPTR(pal)+col%) NEXT What the above code did was it accessed the array and wrote the values to the hardware port 100x faster than QB's PALETTE statement. II. How do I texture a 4-pointed polygon? - QB, VB |
Texture-mapping is a very difficult process, but it will be simplified in this example by leaving out perspective correction. Before explaining how to texture, we will first explain what it is. Texture-mapping is the process of overlaying a rectangular picture on a polygon of any shape. It allows the picture to be warped and contorted to fit the shape of the polygon. | So, how do you actually go about placing a texture on a 4-pointed polygon? Do you calculate the average slope of the polygon? Well, you don't actually calculate the slope and store it in a variable. What you must do is calculate the slope on-the-fly. To do this, on a 4-pointed polygon, you can use one of several methods. The method I use calculates a position of the texel, or the original image's pixel skewed, by finding the distance that texel is from each side of the polygon and finding the percent of each sides' slopes. To do this, you must trace along the image vertically and horizontally inside two loops. Then you take the percent of the distance from each side of the image and use that to calculate the distance between each X and Y on the polygon. To see a pictoral representation, click here. III. How do I change the mouse cursor? - QB |
You can change the mouse cursor two ways: (Note: We don't really recommend the first because it only allows for monochrome cursors.) | IV. How do I use multiple libraries in a program? - QB |
Several libraries can be linked into one. This allows one to use multiple libraries at a time such as | Linking several libraries into a LIB. Microsoft (R) Overlay Linker Version 3.69 Copyright (C) Microsoft Corp 1983-1988. All rights reserved. Run File [MYLIB.EXE]: List File [NUL.MAP]: Libraries [.LIB]: bcom45.lib+ Libraries [.LIB]: dash.lib+ Libraries [.LIB]: qmidi.lib C:\qb45> Linking several libraries into a QLB. Microsoft (R) Overlay Linker Version 3.69 Copyright (C) Microsoft Corp 1983-1988. All rights reserved. Run File [QB.QLB]: mylib.qlb List File [NUL.MAP]: Libraries [.LIB]: bqlb45.lib C:\qb45> |