/* Program BAR_1.C
**
** Illustrates how to draw a bar.
**
** Bar is drawn and colors are changed every second.
**
** P. H. Anderson, 25 Nov, 94
*/
#include <stdio.h>
#include <graphics.h>
#include <dos.h>
void main(void)
{
int graphdriver = DETECT, graphmode, linestyle=0, color;
char string[80];
initgraph(&graphdriver, &graphmode, "c:\\turboc");
/* detect and initialize graphics system */
setlinestyle(SOLID_LINE, linestyle, NORM_WIDTH);
for (color=0; color<16; color++)
{
setcolor(WHITE); /* outline of bar is white */
setfillstyle(SOLID_FILL, color);
/* fill patterns are 0 - 11 */
bar3d(50, 50, 300, 200, 50, 1);
/* bar3d(int startx, int starty, int endx, int endy,
** int depth, int topflag. Note that if depth is 0
** then bar is 2 dimensional, if topflag = 0, there is
** no top
*/
sprintf(string, "Color = %d", color);
setcolor(BLACK); /* text is in black */
outtextxy(100, 100, string);
/* outtextxy, (x, y, text */
sleep(1); /* pause to admire */
}
closegraph();
}