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 - box_functions _ http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   Box_functions                                                     _
   The   display  package  provides  four  functions   for   manipulating
   rectangular  areas  (boxes) of the display  screen.   These  functions
   together  allow the development of high performance windowing or  menu
   systems.  The  disp_peekbox  and  disp_pokebox  functions  allow   the
   contents  of  rectangular areas of the sceen to read into  or  written
   from  a user provided buffer. These functions allow a portion  of  the
   display  to  be  temporarily saved in a buffer,  and  restored  intact
   later.  The disp_box function uses the IBM box drawing  characters  to
   draw  a  border  around a rectangular area  of  screen.  The  function
   disp_fillbox  allows  a  section of the screen to  be  filled  with  a
   particular character and attribute combination.

   Display Package Global Variables
   A number of global variables are initialized when the display  package
   is  opened with a call to the disp_open function described below.  The
   current  status of these globals can be tested in your program.  These
   globals, listed below, should be treated as READ ONLY.

   Globals declared in disp.h:
   unsigned char disp_mono      0 if color and 1 if monochrome.
   unsigned char disp_snowycga!=0 if snowy IBM CGA.
   unsigned char disp_mode        Current display mode.
                                  See disp_setmode().
   unsigned char disp_inited  !=0 if display package open.
   unsigned char disp_ega     !=0 if IBM EGA or VGA.
   unsigned    disp_base          Segment of video display RAM
                                   (MDA = 0B000) (CGA = 0B800)

   (Other values used under OS/2).
   Globals not declared in disp.h (extern declaration required):
   int disp_activepage       currently active display page.

   int disp_numrows          No. of display rows.
   int disp_numcols          No. of display columns.
   int disp_cursorrow        Row of cursor position.
   int disp_cursorcol        Col.   cursor position.
   int disp_cursortype       current cursor type.

   See disp_setcursortype()

   The following is an example of the use of some of the display  package
   functions.   The normal procedure in using the display package  is  as
   follows:

   1.Set  the display mode via a call to disp_mode or disp_set43  if  the
   current mode is not desired.
   2.Call disp_open to open the display package.
   3.Set up the display attributes required using disp_setattr.
   4.Set up the cursor type, if required, using disp_setcursortype.
   5.Use disp_printf etc.
   6.Before  getting  user  input (gets, getche) or using  a  standard  C
   library function which writes to stdin (printf, putc, puts) if this is
   not redirected, call disp_flush to update the cursor position.
   7.Close the display package with a call to disp_close.

   For  further  explanation  of  individual  functions,  see  their
   respective descriptions.

   #include <disp.h>
   #include <conio.h>
   char *string = "Blinking Example String";
   int cursor = ((6*256)+11);

   main()
   {
   char ch;
        disp_open();
        disp_startstand();
        disp_printf("displayed after call to disp_startstand\n");
        disp_endstand();
        disp_setattr(DISP_BLINK | DISP_NORMAL);
        disp_printf("%s\n",string);
        disp_setattr(DISP_INTENSITY | DISP_NORMAL);
        disp_printf("Attribute set to High Intensity\n");
        disp_setattr(DISP_NORMAL);
        disp_usebios();
        disp_printf("String displayed using BIOS\n");
        disp_printf("Change cursor size, Press any key: ");
        disp_setcursortype(cursor);
        disp_flush();
        ch = getch();
        disp_close();
   }
   Refer  to  the file menu.c on your distribution disks  for  a  helpful
   example of the use of the Display_package for producing pop up menus.


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