Try to make a program to display all 64 EGA colors, but when I compil it, I receive the next error : graph.h : No such file or directory.
Understand that i must link that library. Way i have made : build options -> linker settings -> Add -> C::B -> lib ....
I dont find that library.
Thank you.
#define xsize 27
#define ysize 14
#include <graph.h> /* link with GRAPHICS.LIB */
#include <dos.h>
main()
{
int i, R,G,B;
_setvideomode(0x13); /* set 256-color mode */
for (i=0; i<=64; i++) { /* assign EGA colors to VGA registers */
if ((i & 32) == 32) R=21; else R=0;
if ((i & 16) == 16) G=21; else G=0;
if ((i & 8) == 8) B=21; else B=0;
if ((i & 4) == 4) R+=42;
if ((i & 2) == 2) G+=42;
if ((i & 1) == 1) B+=42;
vgacolor(i,R,G,B);
}
showcolor();
getche();
_setvideomode(0x3); /* reset video mode for text mode */
}
vgacolor(registr,red,green,blue)
int registr, red, green, blue;
{
union REGS inreg, outreg;
inreg.x.ax = 0x1010;
inreg.x.bx = registr;
inreg.h.dh = red;
inreg.h.ch = green;
inreg.h.cl = blue;
int86(0x10, &inreg, &outreg);
}
showcolor()
{
int o, color, x,y;
for (o=0, y=-4, color=0; o < 8; o++)
for (x=4, y+=(ysize+7); x < 320; x+=(xsize+13)) {
_setcolor(247); _rectangle(_GFILLINTERIOR,x+3,y+3,x+xsize+3,y+ysize+3);
_setcolor(color++); _rectangle(_GFILLINTERIOR,x,y,x+xsize,y+ysize);
}
}
Edited by Alyn, 30 October 2011 - 04:27 AM.
added code tag


Sign In
Create Account

Back to top









