home *** CD-ROM | disk | FTP | other *** search
- // Example: 148 from Library Reference
- #include "..\3D-Ware\dddware.h"
- #include <stdio.h>
- struct {
- short col;
- short numpts;
- short x1,y1;
- short x2,y2;
- short x3,y3;
- short x4,y4;
- } square = { 15,4,0,0,0,0,0,0,0,0 };
- void DisplayColors(void); // Declare prototype.
- short main(void)
- {
- dddInitVideo();
- dddInit3d();
- dddInitKeybd();
- dddSetStandardPalFromIff("COLORS.LBM"); // Get the color palette from "COLORS.LBM".
- dddScreenSwap(); // Initialise the screen swapping.
- dddSetPal(dddstandardpal); // Set VGA registers from the loaded palette.
- DisplayColors(); // Display the palette we have loaded.
- dddScreenSwap();
- while(!dddkeycode); // Wait for a keypress before quitting.
- dddRestoreKeybd();
- dddClose3d();
- dddRestoreVideo();
- return 0; // Bye.
- }
- void DisplayColors(void)
- {
- int col,x,y;
- char msg[20];
- col = -1;
- for(y=0; y<(200-15); y+=12) {
- for(x=0; x<320; x+=20) {
- col = (col + 1) & 255;
- square.col = col;
- square.x1 = x;
- square.x2 = x+19;
- square.x3 = x+19;
- square.x4 = x;
- square.y1 = y;
- square.y2 = y;
- square.y3 = y+11;
- square.y4 = y+11;
- dddDrawPoly((void far *)&square); // Draw a square on the screen.
- sprintf(msg,"%d",col);
- dddGamePrint3(0,x+2,y+2,msg); // Print the color number as a shadow.
- dddGamePrint3(255,x+1,y+1,msg); // Print the color number as a highlight.
- dddGamePrint3(0,90+2,193+2,"PRESS ANY KEY TO EXIT.");
- dddGamePrint3(255,90+1,193+1,"PRESS ANY KEY TO EXIT.");
- }
- }
- }
-