Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>registerbgidriver() register linked-in graphics driver file</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 registerbgidriver()     Register Linked-in Graphics Driver File

 #include   <graphics.h>

 int        registerbgidriver(driver);
 void       (*driver)(void);

    registerbgidriver() allows a different graphics driver file to be
    linked directly into your program file. (Normally initgraph() does this
    automatically.)  C++ provides the driver files (*.BGI files) found in
    the following list. The parameter needed by registerbgidriver() to
    register the driver file is one of the symbolic names (defined in
    graphics.h) below:

     Driver file         registerbgidriver
     (*.BGI)             symbolic name

     CGA                 CGA_driver
     EGAVGA              EGAVGA_driver
     HERC                Herc_driver
     ATT                 ATT_driver
     PC3270              PC3270_driver
     IBM8514             IBM8514_driver

    Before registerbgidriver() can be called, there are several steps
    that must be gone through. The specified driver file (*.BGI file)
    must first be converted to an object file using BGIOBJ.EXE for
    example:

               bgiobj cga

    creates CGA.OBJ.

    Then the object file must be added to GRAPHICS.LIB using TLIB.

               tlib graphics +cga

    Finally the driver file is registered in your graphics program using
    registerbgidriver().  registerbgidriver() must be called before
    initgraph().


    Returns:    An internal driver number, on success.  If the specified
                driver is invalid, a negative graphics error code is
                returned.

   -------------------------------- Example ---------------------------------

           #include <graphics.h>

           int gdriver, gmode;

           main()
           {
               if (registerbgidriver(CGA_driver) < 0) {
                   printf("invalid driver\n");
                   getch();
               }
               else {
                   initgraph(&gdriver,&gmode,"");
                   printf("driver set: #%d\n",gdriver);
                   getch();
                      .
                      .
                 /* graphic operations */

                   closegraph();
               }
           }


See Also: initgraph() registerbgifont()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson