Thread: graphics in C++
View Single Post
  #1 (permalink)  
Old August 4th, 2005, 07:01 AM
MASTER_1st MASTER_1st is offline
Registered User
 
Join Date: Aug 2005
Location: Warsaw, , Poland.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default graphics in C++

I have problem connected with activete library (graphics.h)
under rhide (compilator C++). I set in motion programm with
help and are problems (BGI graphics not ANSI compatible) and
not identifity functions contents in this library. My programm:

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>

int main(void)
{
   /* request auto detection */
   int gdriver = DETECT, gmode, errorcode;
   int xmax, ymax;

   /* initialize graphics and local variables */
   initgraph(&gdriver, &gmode, "");

   /* read result of initialization */
   errorcode = graphresult();
   /* an error occurred */
   if (errorcode != grOk)
   {
      printf("Graphics error: %s\n", grapherrormsg(errorcode));
      printf("Press any key to halt:");
      getch();
      exit(1);
   }

   setcolor(getmaxcolor());
   xmax = getmaxx();
   ymax = getmaxy();

   /* draw a diagonal line */
   line(0, 0, xmax, ymax);

   /* clean up */
   getch();
   closegraph();
   return 0;
}
(*)Where is error?

Reply With Quote