Author Topic: Turbo C Initializing Graphics Screen perfectly  (Read 1449 times)

kathir

  • Administrator
  • Sr. Member
  • *****
  • Posts: 283
Turbo C Initializing Graphics Screen perfectly
« on: June 14, 2011, 03:35:14 pm »
Here is the perfect way to initialize the graphics screen. Make sure *.BGI is on your PATH.


int InitGraphics()
{
      int grd, grm;
      int gresult;
      // Detect the graphics driver and mode
      detectgraph(&grd,&grm);
      // initialize the graphics mode with initgraph
      initgraph(&grd, &grm, "");
 
      gresult = graphresult();
      if(gresult != grOk)
      {
            printf(grapherrormsg(gresult));
            getch();
            return -1;
      }
 
      // set the background color
      setbkcolor(RED);
      // set the foreground color
      setcolor(WHITE);
      // draw a white color border with rectangle
      rectangle(0,0,getmaxx(),getmaxy());
      return 1;
}



For more details, visit us at: http://www.softwareandfinance.com

 


Disclaimer: This web site is for educational and informational purposes only. Click here to read the Disclaimer.
Content copyright 2010-2014. Kathiresan. All rights reserved.
This page is using SMF version 2.0.1