"BGI Graphics are not supported under Windows" - I`ve got this message working in Borland C++ 5.01.
File (house.cpp) should include graphics.
Project contents: home.cpp;
myheader.h
Myheader.h contents:
#include<conio.h>
#include<ctype.h>
#include<dos.h>
#include<fstream.h>
#include<io.h>
#include<iostream.h>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<cstring.h>
Home.cpp contents:
// using borland graphics to construct a house
// house.ide (house.cpp) 17-03-04
#include"myheader.h"
#include<graphics.h>
// prototype functions
void house();
void lorry();
void main()
{
int select = 3;
do
{
textbackground(1);
clrscr();
cout << "\n\nBasic graphical shapes: House and Lorry\n\n";
textcolor(14);
cprintf("Menu: Please select an option");
cout << "\n\n";
textcolor(10);
cprintf("1. Select a HOUSE diagram");
cout << "\n";
cprintf("2. Select a LORRY diagram");
cout << "\n";
cprintf("3. Exit the program");
cout << "\n\n";
textcolor(15);
cprintf("Enter 1, 2 or 3 (to end): ");
cin >> select;
switch ( select )
{
case 1 : house(); break;
case 2 : lorry(); break;
case 3 : cout << "\n\n\tProgram Exit (press enter) "; break;
default :
cout << "\n\n\tEnter correct value please (press enter): ";
getch();
} // end switch/case
} // end do/while loop
while ( select != 3 );
getch();
} // end main
void house()
{
int gd = DETECT, gm;
// open the graphics window
initgraph(&gd,&gm,"f:\\bc5\\bgi");
// set background colour
clrscr();
setbkcolor(BLUE);
//clrscr();
// basic house shape
bar(200,150,600,420);
setcolor(BLACK);
rectangle(200,150,600,420);
// front door
setfillstyle(1,4);
bar(370,310,430,420);
setcolor(YELLOW);
outtextxy(390,330,"154");
rectangle(370,310,430,420);
setfillstyle(1,15);
fillellipse(420,370,4,4);
// basic garage shape
setfillstyle(2,RED);
bar(50,280,200,420);
rectangle(50,280,200,420);
setfillstyle(1,15);
fillellipse(125,410,7,4);
//moveto(50,280); lineto(200,200);
// garage roof
setfillstyle(9,RED);
setbkcolor(3);
int poly1[6];
poly1[0] = 50;
poly1[1] = 280;
poly1[2] = 200;
poly1[3] = 200;
poly1[4] = 200;
poly1[5] = 280;
fillpoly(3,poly1);
// windows (left upstairs)
setfillstyle(1,10);
bar(220,180,370,270);
setcolor(BROWN); // window frame
rectangle(220,180,370,270);
moveto(220,225); lineto(370,225);
moveto(295,180); lineto(295,270);
setfillstyle(1,12); // window ledge
bar(215,270,375,280);
// right upstairs
setfillstyle(1,10);
bar(430,180,580,270);
setcolor(BROWN); // window frame
rectangle(430,180,580,270);
moveto(430,225); lineto(580,225);
moveto(505,180); lineto(505,270);
setfillstyle(1,12); // window ledge
bar(425,270,585,280);
// right downstairs
setfillstyle(8,10);
bar(460,300,570,390);
setcolor(BROWN);
rectangle(460,300,570,390);
moveto(460,345); lineto(570,345);
moveto(515,300); lineto(515,390);
setfillstyle(1,12); // window ledge
bar(455,390,575,400);
// left downstairs
setfillstyle(8,10);
bar(230,300,340,390);
setcolor(BROWN);
rectangle(230,300,340,390);
moveto(230,345); lineto(340,345);
moveto(285,300); lineto(285,390);
setfillstyle(1,12); // window ledge
bar(225,390,345,400);
// basic roof shape
bar(300,10,350,50);
rectangle(300,10,350,50);
// set up an array for the polygon
setfillstyle(8,RED);
setbkcolor(3);
int poly[8];
poly[0] = 200; // first x position
poly[1] = 150; // first y position
poly[2] = 250; // second x position
poly[3] = 50; // second y position
poly[4] = 550; // third x position
poly[5] = 50; // third y position
poly[6] = 600; // final x position
poly[7] = 150; // final y position
// place the polygon on the diagram
fillpoly(4,poly);
setfillstyle(1,15);
fillellipse(60,60,30,30);
setfillstyle(1,7);
fillellipse(60,60,3,2);
moveto(60,60); lineto(50,50); lineto(40,60);
moveto(60,60); lineto(70,50); lineto(80,60);
getch();
closegraph();
} // end house
// lorry function
void lorry()
{
int gd = DETECT, gm;
// open the graphics window
initgraph(&gd,&gm,"f:\\bc5\\bgi");
// lorry shape
"f:\\bc5\\bgi" - stored at 2-nd HD(f).
Thanks for answer for the previous question.
getch();
closegraph();
} // end lorry