Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - fg_init http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
                                 fg_init

   Usage
   #include <fg.h>
   int far fg_init(void);

   Description
   Initialize the graphics variables and put the crt in graphics mode. If
   the fg graphics package has never been initialized fg_init will search
   the environment for "FG_DISPLAY" and use the board and mode  specified
   by  that environment string. If the "FG_DISPLAY" is not found  the  an
   attempt  is made to identify the current graphics  hardware  available
   and initialize it to the highest resolution available (maximum  number
   of  pixels which may not be the maximum number of colors). It  returns
   fg_display which is non-zero if the initialization was successful.

   If fg_term is called, then fg_init is called fg_init will restore  the
   previously set graphics mode. This is useful if the program has called
   a  specific  initialization  routine (such as  fg_init_vga13)  at  the
   beginning of the program and later wants to temporarily switch to text
   mode  without  the  additional  overhead  of  'remembering'  what  the
   specific initialization routine was that was previously called.

   Example
   This is useful if you need to temporarily switch to text mode

   int status = 0;

   fputs("EGA found. Monochrome (M) or Color Display (C)?",stdout);
   fflush(stdout);

   switch (getc(stdin))
   {
   case 'M'
   case 'm'
   status = fg_init_egamono();
   break;
   case 'c'
   case 'C'
   status = fg_init_egaecd();
   break;
   default
   status = 0;
   }

   if(status == 0)
   return;

   /* MORE CODE */

   fg_term();
   system("dir");
   fg_init();

   /* MORE CODE */

   fg_term();


   Usage
   #include <fg.h>

   Function Prototype                 Environment Variable
   int far fg_init_all(void);                                         _
   int far fg_init_cga(void);         CGAHIRES                        _
   int far fg_init_cgamedres(void);   CGAMEDRES                       _
   int far fg_init_egacolor(void);    EGACOLOR                        _
   int far fg_init_egaecd(void);      EGAECD                          _
   int far fg_init_egamono(void);     EGAMONO                         _
   int far fg_init_evgahires(void);   EVGAHIRES                       _
   int far fg_init_herc(void);        HERC or HERCFULL                _
   int far fg_init_null(void);                                        _
   int far fg_init_vga11(void);       VGA11                           _
   int far fg_init_vga12(void);       VGA12                           _
   int far fg_init_vga13(void);       VGA13                           _
   int far fg_init_vegavgahires(void);VEGAVGAHIRES                    _
   int far fg_init_toshiba(void);     TOSHIBA                         _
   int far fg_init_8514a(void)        8514A                           _

   Description
   Initialize  Graphics  Display Device If not already in  graphics  mode
   save current mode of display device, so it can be restored by fg_term.
   Put  display  device into its graphics mode. Set the  current  display
   page  to page 0. Store the characteristics of the display device  into
   the global variables.

   On  output  fg.display is set to the return value,  fg.activepage  and
   fg_displaypage are set to 0. Page 0 is set to FG_BLACK.

   Return Value
   FG_XXXX Display type that was opened. FG_NULL (0) if failure.

                                fg_init_all()

   will  attempt  to  determine  the type of  display  graphics  that  is
   available  and  open  that display device.  The  environment  variable
   FG_DISPLAY=XXXXX will override. The environment variable override will
   be  primarily  useful  for oddball clone boards, or  for  boards  that
   emulate  multiple  other  boards. fg_init_all is  obsolete  but  still
   exists  for  backward  compatibility, use fg_init  for  new  programs.
   fg_init_all may not exist in future releases.

                                fg_init_cga()

   will assume that the graphics device is a CGA board and put it in
   640 x 200 x 2 color mode (mode 0x6).

      fg_init_cgamedres()
   will assume that the graphics device is a CGA board and put it in
   320 x 200 x 4 color mode (mode 0x4).

                             fg_init_egacolor()
   will  assume that the graphics device is a EGA board with a IBM  color
   monitor  (not enhanced color monitor) and put it into 640 x 200  x  16
   color mode (mode 0xe).

                              fg_init_egaecd()
   will  assume that the graphics device is a EGA board with  a  enhanced
   color monitor and put it into 640 x 350 x 16 color mode (mode 0x10).

                             fg_init_egamono()
   will  assume  that  the  graphics device is a EGA  board  with  a  IBM
   monochrome  monitor  and put it into 640 x 350 x 4  color  mode  (mode
   0xf).

                            fg_init_evgahires()
   will  assume  that the graphics device is a Everex EVGA board  with  a
   multifrequency monitor and put it into 800 x 600 x 16 color mode.

                               fg_init_herc()
   will  assume  that the graphics device is a Hercules  board.  It  will
   determine  if there are 1 or 2 pages available and put it into  720  x
   348 x 2 color mode.

                               fg_init_null()
   is the bit-bucket graphics device. It always returns FG_NULL.

                              fg_init_vga11()
   will  assume that the graphics device is a VGA board and put  it  into
   640 x 480 x 2 color mode (mode 0x11).

                              fg_init_vga12()
   will  assume that the graphics device is a VGA board and put  it  into
   640 x 480 x 16 color mode (mode 0x12).

                              fg_init_vga13()
   will  assume that the graphics device is a VGA board and put  it  into
   320 x 200 x 256 color mode (mode 0x13).

                           fg_init_vegavgahires()
   will  assume that the graphics device is a Video 7 VEGA VGA board  and
   put it into 800 x 600 x 16 color mode.

                             fg_init_toshiba()
   will assume that the graphics device is a Toshiba 3100 and put it into
   640 x 400 x 2 color mode.

                              fg_init_8514a()
   will  assume that the graphics device is an IBM 8514A and put it  into
   graphics mode.

   The  first  attempt  to use the graphics device MUST  be  one  of  the
   fg_init_xxx() functions.

   As new devices are implemented, corresponding functions will be  named
   and available.
   Example

   {
        if(fg_init() == FG_NULL)
        {
             fputs ("Unable to open graphics device.\n", stderr);
             exit(1);
        }
   }


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