Include Graphics H Compilation Terminated Dev C++

7 // In no event will the authors be held liable for any damages arising from the use of this software. Sudo apt-get -y install build-essential checkinstall cmake git libmbedtls-dev libasound2-dev libavcodec-dev libavdevice-dev libavfilter-dev libavformat-dev libavutil-dev libcurl4-openssl-dev libfontconfig1-dev libfreetype6-dev libgl1-mesa-dev libjack-jackd2-dev libjansson-dev libluajit-5.1-dev libpulse-dev libqt5x11extras5-dev libspeexdsp-dev.

/*Program for traffic Light*/


#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
#include<stdlib.h>

void main()
{
clrscr();
int gd = DETECT, gm, midx, midy;
initgraph(&gd, &gm, 'C:TCBGI');

midx = getmaxx()/2;
midy = getmaxy()/2;

setcolor(CYAN);
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 4);
settextjustify(CENTER_TEXT, CENTER_TEXT);
outtextxy(midx, midy-10, 'Traffic Light Simulation');
outtextxy(midx, midy+10, 'Press any key to start');
getch();
cleardevice();
setcolor(WHITE);
Include graphics h compilation terminated dev c++ free settextstyle(DEFAULT_FONT, HORIZ_DIR, 1);
rectangle(midx-30,midy-80,midx+30,midy+80);
circle(midx, midy-50, 22);
setfillstyle(SOLID_FILL,RED);
floodfill(midx, midy-50,WHITE);
setcolor(BLUE);
outtextxy(midx,midy-50,'STOP');
delay(2000);
graphdefaults();
cleardevice();
setcolor(WHITE);
rectangle(midx-30,midy-80,midx+30,midy+80);
circle(midx, midy, 20);
setfillstyle(SOLID_FILL,YELLOW);
floodfill(midx, midy,WHITE);
setcolor(BLUE);
outtextxy(midx-18,midy-3,'READY');

delay(2000);
cleardevice();
setcolor(WHITE);
rectangle(midx-30,midy-80,midx+30,midy+80);

Include Graphics H Compilation Terminated Dev C++ Free


circle(midx, midy+50, 22);
setfillstyle(SOLID_FILL,GREEN);
floodfill(midx, midy+50,WHITE);
setcolor(BLUE);
outtextxy(midx-7,midy+48,'GO');
setcolor(RED);
settextstyle(TRIPLEX_FONT, HORIZ_DIR, 4);
outtextxy(midx-150, midy+100, 'Brrrrrmmmmmm.. :)');

getch();
}


Output:

I am new to Dev C++ and i am creating a program of a game of snake.

In Dev C++ the graphics open in WINDOWS BGI screen whereas the text gets shown in Text console(Dos).
1)i want to know how can i clear the WINDOWS BGI screen ?
2)how can i Close WINDOWS BGI screen so as to return to the text console?

Editedby prabhjitsw because:n/a
  • 4 Contributors
  • forum5 Replies
  • 866 Views
  • 4 Years Discussion Span
  • commentLatest PostLatest Postby amit_26

Include Graphics H Compilation Terminated Dev C++ Code

Recommended Answers

#1: repaint the entire screen in the same color. Something like this:

#2: I know of no way to do that. The program is …

Jump to Post

Include Graphics H Compilation Terminated Dev C++

>> AS U CAN SEE IN MY PROGRAMME ..
Please don't SHOUT, thank you.

As for the problem, I believe closegraph() will do what you want.

Jump to Post

All 5 Replies

Ancient Dragon5,243Achieved Level 70 Team ColleagueFeatured Poster

Include Graphics H Compilation Terminated Dev C++ Program

#1: repaint the entire screen in the same color. Something like this:

#2: I know of no way to do that. The program is created for either text or windows, the two can not be mixed in the same program.

Editedby Ancient Dragon because:n/a