home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / cprog / guilib20.zip / GUI.DOC < prev    next >
Text File  |  1993-01-16  |  46KB  |  1,309 lines

  1. ****************************************************************************
  2.  
  3.                  Documentation for
  4.         GUI_LIB Library for Borland C++ and Turbo C++
  5.                 Version 2.0
  6.  
  7.          (c) Copyright 1993 - David S. Reinhart Associates
  8.                   (717) 284-3736
  9. ****************************************************************************
  10.  
  11. All files included on this distribution diskette are (c) Copyright 1993,
  12.                David S. Reinhart Associates
  13.  
  14.  
  15.     Congratulations! You have just received one of the finest graphics 
  16.     libraries available for use with Borland C++ and Borland's Turbo C++ 
  17.     compilers. Using the GUI library will enable you to create 
  18.     graphic based applications to run in DOS just as easily as creating 
  19.     text based applications. The objects included in the library are all 
  20.     familiar objects, found in many commercially available software 
  21.     packages. They include pushbuttons, icons, text entry fields, and 
  22.     bitmaps to name just a few. Some of the features in this library are 
  23.     found nowhere else! Now you can harness the power and intuitiveness 
  24.     of the Graphic User Interface for use in your applications. From 
  25.     paint programs to databases, all of your programs can benefit from 
  26.     the use of graphics. 
  27.  
  28.     If you have not already done so, I would suggest that you stop 
  29.     reading this documentation for a moment to check out the demo 
  30.     provided on the distribution diskette. The name of the demo is 
  31.     simply DEMO.EXE. In order to run the demo you must first have 
  32.     loaded your mouse driver. Any Microsoft, Logitech, or compatible 
  33.     mouse will be fine. From the DOS prompt type DEMO <ENTER>. The 
  34.     demo highlights most of the objects in the library. After viewing 
  35.     the demo, return to the documentation.
  36.  
  37.  
  38.                 SHAREWARE
  39. ****************************************************************************
  40.  
  41.     The GUI library and it's included files are being distributed as 
  42.     Shareware. They are complete and not crippled in any way. You may 
  43.     use these files for a 30 day period free of charge. You may not, 
  44.     however, distribute any works created with these files in any way, 
  45.     shape or form until you have registered your copy of the package. 
  46.     If after 30 days you decide to continue using the files in this 
  47.     package you are obligated to register with the author. The concept 
  48.     of Shareware helps to keep the cost of quality software low. Please 
  49.     do your part by registering this software. Use of the software 
  50.     contained in this package after 30 days without registration will 
  51.     bring about sever penalties.
  52.  
  53.     This software package is comparable with many retail libraries 
  54.     costing hundreds of dollars. It is through the concept of Shareware 
  55.     that I am able to bring this software to you at a much reduced cost. 
  56.     What's more, registered users will receive one upgrade free of cost 
  57.     rather than at an upgrade cost. 
  58.  
  59.     The price of this package is as follows:
  60.  
  61.         Single user license - $35
  62.             includes free copy of the next major upgrade of the
  63.             package.
  64.  
  65.         Corporate user license - $60
  66.             includes free copy of the next major upgrade of the
  67.             package.
  68.  
  69.  
  70.     Please use the registration form included with this package to 
  71.     register your copy. The form can be found in the file REGISTER.DOC.
  72.  
  73.     Thank you
  74.  
  75.     If you like this product you may also wish to order the
  76.     ObjectEase library also from this author. This library makes it 
  77.     easy to migrate into the realm of C++ programming by offering
  78.     the widest range of classes available in any library at any
  79.     cost. Include a note on your registration form to receive a demo
  80.     of the ObjectEase library.
  81.  
  82.  
  83.  
  84.                  Use of the GUI library
  85.  
  86.     In order to utilize the objects and functions in the GUI 
  87.     library you need only add the GUI.LIB library to your project, 
  88.     and include the header file in your program code. You can then 
  89.     declare object instances and call the functions as you would with 
  90.     any other library. You must, of course, first initialize the 
  91.     graphics mode with a call to initgraph(). The best way to do this
  92.     is by using one of the member functions of the Screen class, new 
  93.     in version 2.0. The GUI.LIB library file was compiled under the 
  94.     large memory model using Borland C++ 3.1 and should be included 
  95.     only in projects that are also to be compiled for the large memory 
  96.     model. This is because the use of graphics can be very memory 
  97.     intensive and the large memory model gives the program access to 
  98.     all of the available RAM, not just a single 64K data segment.
  99.  
  100.     This documentation is divided into sections describing each of the 
  101.     various graphic objects followed by a description and examples of 
  102.     all of the methods that may be used with the object. Please take 
  103.     special note of the example fragments as they may be of great help 
  104.     to you in getting to know the proper use of these objects and 
  105.     methods. I'll start by describing the objects new in version 2.0.
  106.     If you are familiar with version 1.0, you should also check out
  107.     the new editors included in this version, as well as the file
  108.     EDITORS.DOC which describes their use.
  109.  
  110. ****************************************************************************
  111.                    SCREEN
  112. ****************************************************************************
  113.  
  114.     The screen class was devised to put the hardware into any of several
  115.     graphics modes and to initialize several other variables that come
  116.     into play when programming for the graphics mode. I would highly
  117.     recommend using this class instead of calling initgraph() directly.
  118.     You should still call closegraph() at the end of your program to
  119.     restore the hardware to it's original state.
  120.  
  121.     Here is the declaration of the Screen class from the header file:
  122.  
  123.     class Screen {
  124.          protected:
  125.         static int huge alwayszero();
  126.          public:
  127.         Screen();
  128.         ~Screen();
  129.         int VGA_480_16();
  130.         int VGA_350_16();
  131.         int VGA_200_16();
  132.         int VGA_200_256();
  133.         void fill(int);
  134.         };
  135.  
  136.     As you can see, this class is really only useful for VGA modes,
  137.     but I think that this is where 95% of all graphics programming
  138.     is done anyway.
  139.  
  140.     Class Screen is very simple to use. You should declare an instance
  141.     of this class as a global variable. Consider this short example:
  142.  
  143.     Screen screen;
  144.  
  145.     void main()
  146.     {
  147.         screen.VGA_200_256();
  148.         ...
  149.  
  150.     That's really all there is to it. The screen object will (re)init-
  151.     ialize the mouse driver if one is present. This is because I have 
  152.     found that Logitech mice are not always capable of reaching the
  153.     entire screen if they are not initialized AFTER the screen changes
  154.     modes.
  155.  
  156.     Use the fill(int) member function with an integer paremeter re-
  157.     presenting the color you would like to clear the screen with.
  158.     For example:
  159.  
  160.     Screen screen;
  161.  
  162.     void main()
  163.     {
  164.         screen.VGA_200_256();
  165.         screen.fill(15);        //clears the screen to white
  166.         ...
  167.  
  168. ***************************************************************************
  169.                   MCURSOR
  170. ***************************************************************************
  171.  
  172.     The Mcursor object controls and gets information about the mouse
  173. cursor. This is the only new class that will cause you to do some re-
  174. coding if you use version 2.0 of the GUI library to re-compile programs
  175. which you have written with version 1.0.
  176.  
  177. Several predefined shapes for the graphics mouse cursor have been
  178. included in the GUI library, however, at this time there is no
  179. provision for including your own designs with the Mcursor class.
  180.  
  181. ****************************************************************************
  182.     Note: The instance "Mcursor the_mouse;" has been pre-defined in
  183. the header file. This is because many of the objects in this library
  184. make use of the Mcursor object on their own. You need to declare this
  185. same instance of the Mcursor class within your code or the mouse will
  186. not function as you expect. When you declare an Mcursor instance in your
  187. code simply declare it as external like this:
  188.  
  189.     extern Mcursor the_mouse;       //you MUST name your instance
  190.                     //the_mouse
  191. ****************************************************************************
  192.  
  193.  
  194. int Mcursor::init()
  195.     Initializes the mouse. This function must be called before trying
  196.     to use any of the other mouse functions. If a mouse driver is
  197.     detected the function will return 1, if no mouse driver is present
  198.     it will return 0.
  199.  
  200.     example:        extern Mcursor the_mouse;
  201.                 if(!the_mouse.init()) {
  202.                     puts("No mouse driver detected");
  203.                     exit(0);
  204.                     }
  205.     The Mcursor instance is immediately put into a state of "unarmed."
  206.     You must "arm" the instance before it can be displayed.
  207.  
  208.  
  209. void Mcursor::show()
  210.     Makes the mouse cursor visible on the screen.
  211.  
  212.     example:        extern Mcursor the_mouse;
  213.                 the_mouse.init();
  214.                 the_mouse.show();
  215.  
  216.  
  217. void Mcursor::hide()
  218.     Makes the mouse cursor invisible.
  219.     
  220.     example:        extern Mcursor the_mouse;
  221.                 the_mouse.init();
  222.                 getch();
  223.                 the_mouse.hide();
  224.  
  225.  
  226. void Mcursor::unarm()
  227.     Makes the mouse cursor invisible, and keeps other object instances 
  228. from turning it back on. Any object that needs to draw itself on the 
  229. screen will turn off the mouse cursor while it is manipulating the 
  230. screen and then turns it back on when it is finished. If you don't want 
  231. an object to have the capability of restoring the mouse cursor to the 
  232. screen you must call Mcursor::unarm().
  233.  
  234.     example:        extern Mcursor the_mouse;
  235.                 the_mouse.init();
  236.                 the_mouse.unarm();      //hides the mouse cursor 
  237.                             //and keeps it from     
  238.                             //being restored by     
  239.                             //other objects                 
  240.                             //instances.
  241.  
  242.  
  243. void Mcursor::arm()
  244.     Restores the mouse cursor to the screen and allows other object 
  245. instances to restore it to the screen when they have finished updating 
  246. the screen. YOU MUST CALL THIS MEMBER FUNCTION AFTER INITIALIZING THE
  247. MOUSE BECAUSE IT IS UNARMED UPON INITIALIZATION!
  248.  
  249.     example:        extern Mcursor the_mouse;
  250.                 the_mouse.init();
  251.                 the_mouse.unarm();
  252.  
  253.                 ...do some screen manipulation
  254.  
  255.                 the_mouse.arm();
  256.  
  257.  
  258. void Mcursor::set_hor_bounds(int left,int right)
  259.     Sets the horizontal bounds of the mouse cursor movement.
  260.  
  261.     example:        extern Mcursor the_mouse;
  262.                 the_mouse.init();
  263.                 the_mouse.set_hor_bounds(100,getmaxx()-100);
  264.                 // the mouse cursor now cannot move closer than 
  265.                 //100 pixels to the sides of the screen.
  266.  
  267.  
  268. void Mcursor::set_ver_bounds(int top,int bottom)
  269.     Sets the vertical bounds of the mouse cursor movement.
  270.  
  271.     example:        extern Mcursor the_mouse;
  272.                 the_mouse.init();
  273.                 the_mouse.set_ver_bounds(100,getmaxy()-100);
  274.                 //the mouse cursor now cannot move closer than  
  275.                 //100 pixels to the top or bottom of the screen.
  276.  
  277.  
  278. void Mcursor::position(int x,int y)
  279.     Moves the mouse to the specified coordinates on the screen.
  280.  
  281.     example:        extern Mcursor the_mouse;
  282.                 the_mouse.init();
  283.                 the_mouse.position(0,0);
  284.                 //the mouse cursor is now in the upper left     
  285.                 //corner of the screen. 
  286.  
  287.  
  288. void Mcursor::conditional_off(int x,int y,int x1,int y1)
  289.     Declares a portion of the screen where the mouse cursor will not 
  290.     be visible.
  291.  
  292.     example:        extern Mcursor the_mouse;
  293.                 the_mouse.init();
  294.                 the_mouse.conditional_off(0,0,100,100);
  295.                 //the mouse cursor will not be visible in the   
  296.                 //upper left corner of the screen.
  297.  
  298.  
  299. int Mcursor::LBP()
  300.     Returns 1 if the left mouse button is pressed, 0 otherwise.
  301.  
  302.     example:        extern Mcursor the_mouse;
  303.             int done=0;
  304.                 the_mouse.init();
  305.                 while(!done) {
  306.                     if(the_mouse.LBP()) 
  307.                         done=1;
  308.                     }
  309.                 printf("\a");
  310.  
  311. int Mcursor::RBP()
  312.     Returns 1 if the right mouse button is pressed, 0 otherwise.
  313.  
  314.     example:        extern Mcursor the_mouse;
  315.             int done=0;
  316.                 the_mouse.init();
  317.                 while(!done) {
  318.                     if(the_mouse.RBP()) 
  319.                         done=1;
  320.                     }
  321.                 printf("\a");
  322.  
  323. int Mcursor::mx()
  324.     Returns an integer representing the x coordinate of the mouse 
  325.     cursor.         
  326.  
  327.     example:        extern Mcursor the_mouse;
  328.             int x;
  329.                 the_mouse.init();                       
  330.                 x=the_mouse.mx();
  331.  
  332.  
  333. int Mcursor::my()
  334.     Returns an integer representing the y coordinate of the mouse 
  335.     cursor.
  336.  
  337.     example:        extern Mcursor the_mouse;
  338.             int y;
  339.                 the_mouse.init();
  340.                 y=the_mouse.my();
  341.  
  342.  
  343. void Mcursor::changeto(int)
  344.     Changes the shape of the graphics mouse cursor. Has no effect on 
  345.     the text mode mouse cursor. This function first determines the 
  346.     current shape of the mouse cursor. If the current shape is the 
  347.     same as the one you are requesting it to change to the function 
  348.     will exit with no action taken.
  349.  
  350.     example:        extern Mcursor the_mouse;
  351.                 the_mouse.init();
  352.                 the_mouse.changeto(CROSSHAIR);
  353.  
  354.     Note:   The following cursor shapes are predefined and may be used 
  355. as the parameter to the Mcursor::changeto(int) function:
  356.  
  357.     #define UPARROW 1
  358.     #define DOT 2
  359.     #define PENCIL 3
  360.     #define CROSSHAIR 4
  361.     #define ARROW 5
  362.     #define FINGER 6
  363.     #define POINT 7
  364.     #define CLOCK 8
  365.     #define DISK 9
  366.     #define IBAR 10
  367.     #define PAINTCAN 11
  368.     #define HAND 12
  369.     #define ERASOR 13
  370.     #define GUNSIGHT 14
  371.     #define SCISSORS 15
  372.     #define JAWS 16
  373.  
  374.  
  375.  
  376.     These are the member functions of the Mcursor class. I'm sure
  377. you'll find them as easy to implement as they are powerful to use. In
  378. these days of the Graphical User Interface, mouse routines are becoming
  379. a standard even in text based applications. These tools out the power of
  380. the mouse in your hands.
  381.  
  382. ***************************************************************************
  383.                 BITMAPS
  384. ***************************************************************************
  385.  
  386.     The Bitmap object is used to display and capture graphic images.
  387. There are two editors included in this package to create bitmap images.
  388. The files are in the Borland getimage() format, which is certainly not
  389. the most compressed format for image storage. Future versions of this
  390. library are sure to include Bitmap objects with various graphic file
  391. formats. The bitmap editors are 16IMAGE.EXE and 256IMAGE.EXE for
  392. creating 16 and 256 color bitmaps respectively.
  393.  
  394. Bitmap::Bitmap()
  395.     The default constructor.
  396.  
  397.  
  398. Bitmap::~Bitmap()
  399.     The default destructor.
  400.  
  401.  
  402. void Bitmap::init(int x,int y)
  403.     Initializes a bitmap object. The x and y parameter represent the
  404.     x,y coordinates for displaying the bitmap. If this coordinate pair
  405.     is not known when you initialize the bitmap instance, simply
  406.     initialize it to 0,0.
  407.  
  408. void Bitmap::changexy(int x,int y)
  409.     Changes the x,y coordinates at which to display the bitmap.
  410.  
  411.  
  412. void Bitmap::load(char* name)
  413.     Loads the bitmap image specified in the name parameter from disk.
  414.     This file must have been created by one of the bitmap editors
  415.     included with the GUI library, or by a previous call to
  416.     Bitmap::save(char*).
  417.  
  418.  
  419. void Bitmap::save(char* name)
  420.     Saves a bitmap image to disk. Under most circumstances, this will
  421.     be an image that has been captured using the
  422.     Bitmap::capture(int,int,int,int) member function.
  423.  
  424.  
  425. void Bitmap::capture(int x,int y,int x1,int y1)
  426.     Captures the area bounded by the rectangle x,y,x1,y1 to a Bitmap
  427.     object. This area MUST NOT exceed 64K as this is the maximum size
  428.     for a Borland getimage() buffer.
  429.  
  430.  
  431. void Bitmap::moveto(int x,int y)
  432.     Hides a displyed Bitmap object and re-displays it at the new x,y
  433.     coordinates.
  434.  
  435.  
  436. void Bitmap::hide()
  437.     Removes a displayed Bitmap object from the screen.
  438.  
  439.  
  440. void Bitmap::show_COPY()
  441.     Displays a Bitmap image using the COPY_PUT mode.
  442.  
  443.  
  444. void Bitmap::show_XOR()
  445.     Displays a Bitmap object using the XOR_PUT mode.
  446.  
  447.  
  448. void Bitmap::show_OR()
  449.     Displays a Bitmap object using the OR_PUT mode.
  450.  
  451.  
  452. void Bitmap::show_NOT()
  453.     Displays a Bitmap using the NOT_PUT mode.
  454.  
  455.  
  456. void Bitmap::show_AND()
  457.     Displays a Bitmap object using the AND_PUT mode.
  458.  
  459.  
  460. int Bitmap::isshown()
  461.     Returns 1 if the Bitmap object is displayed on the screen, 0
  462.     otherwise.
  463.  
  464.  
  465. int Bitmap::hit()
  466.     Returns 1 if the mouse cursor is on the Bitmap object, 0
  467.     otherwise.
  468.  
  469.  
  470. int Bitmap::xsize()
  471.     Returns an integer representing the horizontal size of the Bitmap.
  472.  
  473.  
  474. int Bitmap::ysize()
  475.     Returns an integer representing the vertical size of the Bitmap.
  476.  
  477.  
  478. int Bitmap::bitmapx()
  479.     Returns the upper left x coordinate of the Bitmap.
  480.  
  481.  
  482. int Bitmap::bitmapy()
  483.     Returns the upper left y coordinate of the Bitmap.
  484.  
  485.  
  486. int Bitmap::LBSCLK()
  487.     Returns 1 if the left mouse button has been pressed while the
  488.     mouse cursor was on the Bitmap object, 0 otherwise
  489.  
  490.  
  491. int Bitmap::LBDCLK()
  492.     Returns 1 if the left mouse button was pressed twice while the
  493.     mouse cursor was on the Bitmap object. The button must have been
  494.     pressed two times within 1/2 of a second or else the timer resets.
  495.  
  496. ***************************************************************************
  497.                 GCHECKBOXES
  498. ***************************************************************************
  499.  
  500. A Gcheckbox can be used to allow the user to make multiple selections. 
  501. Call "init()" with the following three parameters to initialize a Gcheckbox. 
  502. The x int coordinate, the y int coordinate, and a char * representing the 
  503. descriptive text to be displayed with the Gcheckbox. Call "show()" to 
  504. display the Gcheckbox on the screen. Calling "check()" and "uncheck()" 
  505. will toggle the state of the Gcheckbox, and calling "is_checked()" will 
  506. tell you its current state. The "hit()" member function returns true if 
  507. the mouse cursor is positioned on the Gcheckbox.
  508.  
  509.     Follow this example:
  510.  
  511.     Gcheckbox mybox;
  512.     int done=0;
  513.  
  514.     mybox.init(100,100,"This is a Gcheckbox");
  515.     mybox.show();
  516.     while(!done) {
  517.         if(the_mouse.LBP()) {
  518.             if(mybox.hit()) {
  519.                 if(mybox.is_checked())
  520.                     mybox.uncheck();
  521.                 else
  522.                     mybox.check();
  523.                 }
  524.             }
  525.         }
  526.  
  527.  
  528.     You don't have to use the mouse as the trigger to toggle states.
  529. Any keypress or key combination that you choose can be used to toggle
  530. the state.
  531.  
  532. ****************************************************************************
  533.                 GRADIO
  534. ****************************************************************************
  535.  
  536.     Gradio is the graphics mode version of the radio button. Basically
  537. the way a radio button works is this: First, you must have more than one
  538. of them. If you only need one use a Gcheckbox instead. One of the series
  539. of Gradios is initially selected. When the user selects a different
  540. radio button, the first one becomes de-selected, and the new one becomes
  541. selected, and so on. Remember, unlike a series of Gcheckboxes, only ONE
  542. Gradio can be selected at a time.
  543.  
  544.     Initialize a Gradio by calling "init()" with three parameters. The
  545. first two are ints specifying the x and y coordinates respectively to
  546. display the Gradio, and the third is a char* representing the
  547. descriptive text to be displayed to the right of the Gradio. After
  548. initializing the Gradio you can show it with a call to "show()". Like a
  549. Gcheckbox you can toggle the state of a Gradio with calls to "check()"
  550. and "uncheck()", and test if it has been hit with the mouse cursor by
  551. calling "hit()". Calling "is_checked()" will tell you the current state
  552. of the Gradio.
  553.  
  554.     Let's look at an example:
  555.  
  556.     Gradio rb1,rb2;
  557.     int done=0;
  558.  
  559.     rb1.init(100,100,"This is a radio button");
  560.     rb2.init(100,120,"So is this");
  561.     rb1.show();
  562.     rb2.show();
  563.     while(!done) {
  564.         if(the_mouse.LBP()) {
  565.             if(rb1.hit()) {
  566.                 if(rb1.is_checked()) {
  567.                     rb1.uncheck();
  568.                     rb2.check();
  569.                     }
  570.                 else {
  571.                     rb1.check();
  572.                     rb2.uncheck();
  573.                     }
  574.             if(rb2.hit()) {
  575.                 if(rb2.is_checked()) {
  576.                     rb2.uncheck();
  577.                     rb1.check();
  578.                     }
  579.                 else {
  580.                     rb2.check();
  581.                     rb1.uncheck();
  582.                     }
  583.                 }
  584.             }
  585.         }
  586.  
  587. ***************************************************************************
  588.                   SOUNDQ
  589. ***************************************************************************
  590.  
  591.     The SoundQ class is used for playing music and sounds in the 
  592. background while foreground processes continue to execute. This is a 
  593. feature that you will commonly find in use in game programs, but can be 
  594. useful in any application. If you're like me, you have probably tried to 
  595. find some way to do this before, but the necessary functions are simply 
  596. not available as part of the standard C or C++ libraries. Now you have 
  597. the tools... you have the POWER...the power of the OBJECT!
  598.  
  599.     NOTE: When you include an instance of the SoundQ class in your 
  600. program the timer chip will be reset to tick 500 times per second. The 
  601. normal rate for this chip is 18.2 times per second. Clock functions will 
  602. continue to operate normally as the SoundQ object issues a clock tick at 
  603. the normal rate of 18.2 times per second, however, you may find that you 
  604. need to make adjustments in any delays issued by the "void delay(long)" 
  605. function that comes with the standard library.
  606.  
  607.     Let's take a look at the details of the SoundQ class...
  608.  
  609. SoundQ::SoundQ
  610.     The default constructor.
  611.  
  612.  
  613. SoundQ::~SoundQ
  614.     The default destructor.
  615.  
  616.  
  617. void SoundQ::adjust_speed(float)
  618.     Adjusts the speed of the sounds being played in the background. 
  619.     The default value is 1.0. Increasing this value will slow down the 
  620.     playback, decreasing it will of course speed up the playback. 
  621.     Changing this value to 2.0 will effectively play back the sounds 
  622.     at half speed.
  623.  
  624.     example:        SoundQ sq;
  625.                   sq.adjust_speed(2.0);
  626.  
  627.  
  628. void SoundQ::play(int freq,int duration)
  629.     Places notes in the queue to be played by the SoundQ object. The 
  630.     notes placed in the queue will begin to play immediately. Remember 
  631.     that the timer tick has been reset to tick 500 times per second by 
  632.     the SoundQ object, therefore, to make a note sound for 1 second 
  633.     the duration parameter must be 500.
  634.  
  635.     example:        SoundQ sq;
  636.                 sq.play(440,100);
  637.  
  638.     Note: The following have been defined in the header file, and make  
  639. the programming of music much simpler:
  640.  
  641.     #define C 523   Frequency of Middle C
  642.     #define CS 554  C Sharp
  643.     #define D 587   D
  644.     #define DS 622  D Sharp
  645.     #define E 659   E
  646.     #define F 698   F
  647.     #define FS 740  F Sharp
  648.     #define G 784   G
  649.     #define GS 831  G Sharp
  650.     #define A 880   A
  651.     #define AS 932  A Sharp (or B Flat)
  652.     #define B 988   B
  653.     #define C1 1046 C one octave above middle C
  654.  
  655.     #define SN 32   Duration of sixteenth note
  656.     #define EN 63   Eighth note
  657.     #define QN 125  Quarter note
  658.     #define HN 250  Half note
  659.     #define WN 500  Whole note
  660.     
  661.     #define ENT 20  Duration of eighth note triplet
  662.     #define QNT 41  Duration of Quarter note triplet
  663.     #define HNT 83  Duration of Half note triplet
  664.  
  665.     #define BN 30000,5      Place between two notes of the same     
  666.                     frequency to clearly define the sounding        
  667.                     of two notes.
  668.     #define SR 30000,32     Plays a sixteenth note rest
  669.     #define ER 30000,63     Plays an eighth note rest
  670.     #define QR 30000,125    Plays a quarter note rest
  671.     #define HR 30000,250    Plays a half note rest
  672.     #define WR 30000,500    Plays a whole note rest
  673.     #define NM 30000,1      Stops the sounding of a tone. Use at the        
  674.                     end of a song.
  675.  
  676.     Let's use these defines to play the C Major Scale with quarter  
  677.     notes...
  678.  
  679.         SoundQ sq;
  680.             sq.play(C,QN);
  681.             sq.play(D,QN);
  682.             sq.play(E,QN);
  683.             sq.play(F,QN);
  684.             sq.play(G,QN);
  685.             sq.play(A,QN);
  686.             sq.play(B,QN);
  687.             sq.play(C1,QN);
  688.             sq.play(NM);    //used to stop the sound
  689.  
  690.  
  691.     These defined values can be multiplied or divided to play sounds 
  692. from different octaves. Remember that once you have created a song you 
  693. only need to use SoundQ::adjust_speed to vary the playback speed of the 
  694. song.
  695.  
  696. ****************************************************************************
  697.                 MISCELLANEOUS
  698. ****************************************************************************
  699.  
  700.     The following functions, while not part of any class structure, are
  701. included in this version of the library, and will be of great use to you.
  702.  
  703. void dlay(int ticks);
  704.     Causes a delay of the specified number of clock ticks. Clock ticks 
  705.     occur 18.2 times per second.
  706.  
  707. long getticks();
  708.     Returns the time as a long number representing the number of clock 
  709.     ticks since the preceding midnight.
  710.  
  711. int altkey();
  712.     Returns 1 if an ALT key is pressed, 0 otherwise.
  713.  
  714. int ctrlkey();
  715.     Returns 1 if a CTRL key is pressed, 0 otherwise.
  716.  
  717. int lshiftkey();
  718.     Returns 1 if the LEFT SHIFT key is pressed, 0 otherwise.
  719.  
  720. int rshiftkey();
  721.     Returns 1 if the RIGHT SHIFT key is pressed, 0 otherwise.
  722.  
  723. void flushkeys();
  724.     Clears any and all keypresses from the keyboard buffer.
  725.  
  726. unsigned char getvidmode();
  727.     Returns an unsigned char value representing the current video 
  728.     mode.
  729.  
  730. ****************************************************************************
  731.                    PANELS
  732. ****************************************************************************
  733.  
  734.     Panels can be associated with pop-up windows in a text environment.
  735.     They serve to contain and draw attention to other objects such as
  736.     text or pushbuttons. The class Panel is declared in the header
  737.     file GROBJECT.H as:
  738.  
  739. class Panel:public Point
  740. {
  741.     protected:
  742.         int w;                          WIDTH
  743.         int h;                          HEIGHT
  744.         int in_or_out;                  CONCAVE or CONVEX
  745.         int thick_or_thin;              BORDER STYLE
  746.     public:
  747.         Panel();
  748.         ~Panel();
  749.         virtual void show();
  750.         void init(int xpos,int ypos,int width,int height,
  751.               int inorout,int thickorthin);
  752. };
  753.  
  754.  
  755.     The class POINT from which Panel is derived is the base class for 
  756.     all of the graphic objects in this library.
  757.  
  758.     In order to facilitate the initialization of the inorout and 
  759.     thickorthin variables the definitions IN, OUT, THICK and THIN 
  760.     may be used. These are defined in the header file.
  761.  
  762.     To declare an instance of class PANEL and display it in your 
  763.     application follow the example in the following code fragment.
  764.  
  765.     Panel mypanel;
  766.     mypanel.init(10,10,100,100,IN,THICK);
  767.     mypanel.show();
  768.  
  769.     It's just that simple. Remember that the graphics mode must first 
  770.     be initialized by a call to initgraph. If you are unfamiliar with 
  771.     this function consult your compiler documentation.
  772.  
  773.     All of the objects in this library contain the method "init". 
  774.     You must call "init" with the proper parameters before trying 
  775.     to display the object. There's no telling what might happen if 
  776.     you try to display an uninitialized object.
  777.  
  778. ****************************************************************************
  779.                  BEVELS
  780. ****************************************************************************
  781.  
  782.     Bevels are just like panels with a more decorative border. All 
  783.     calls to their methods are identical except that a call to 
  784.     Bevel.init() takes one less parameter. You do not need to specify 
  785.     IN or OUT because Bevel borders always go out. Here is the 
  786.     definition. I'll skip an example as you can easily follow the 
  787.     Panel example and make appropriate substitutions.
  788.  
  789. class Bevel:public Point
  790. {
  791.     private:
  792.         int w;                          WIDTH
  793.         int h;                          HEIGHT
  794.         int thick_or_thin;              STYLE OF BORDER
  795.         Panel outerbevel;
  796.         Panel innerbevel;
  797.     public:
  798.         void init(int,int,int,int,int);
  799.         virtual void show();
  800. };
  801.  
  802. ****************************************************************************
  803.                  PUSHBUTTONS
  804. ****************************************************************************
  805.  
  806.     Pushbuttons simulate keyboard keys on the screen. They serve to 
  807.     get user input for a variety of purposes. They are very intuitive 
  808.     and can display either a text title or a graphic image.
  809.  
  810. The header file definition of the class Button is:
  811.  
  812. class Button:public Point
  813. {
  814.   protected:
  815.     int state,                  UP or DOWN
  816.     int sizex,                  WIDTH
  817.     int sizey;                  HEIGHT
  818.     char btntxt[40];            TEXT ID 
  819.     int  file_text;             TEXT ID or GRAPHIC IMAGE
  820.     void *picture;              BUFFER CONTAINING GRAPHIC IMAGE
  821.     void getpic(char*);         
  822.   public:
  823.     Button();
  824.     ~Button();
  825.     virtual void show();
  826.     virtual void press();
  827.     void init(int xpos,int ypos,char* text,int);
  828.     int hit();
  829. };
  830.  
  831.     To declare an instance of class Button you need to supply the 
  832.     parameters for the upper left x and y positions, a string which 
  833.     either represents the text to be displayed on the button or the 
  834.     name of the file containing the image to be used on the button, 
  835.     and an integer flag representing whether or not the last parameter 
  836.     refers to text or a filename.
  837.  
  838. The definitions TEXT and IMAGE can be used in this parameter and are 
  839. defined in the header file.
  840.  
  841.     Consider this example:
  842.  
  843.     Button textbutton;
  844.     textbutton.init(10,10," EXIT ",TEXT);
  845.     textbutton.show();
  846.  
  847.     This would create and display a button that said " EXIT " on it.
  848.  
  849.     Consider this:
  850.  
  851.     Button graphbutton;
  852.     graphbutton.init(10,10,"EXIT",IMAGE);
  853.     graphbutton.show();
  854.  
  855.     This would create and display a button containing the image stored 
  856.     in the file "EXIT.BTN". The file extension should not be included 
  857.     in the parameter as ".BTN" is the assumed extension. The graphic 
  858.     file must be present on the disk before trying to call this function. 
  859.     Using the ICONEDIT program supplied with this package you can very 
  860.     easily create these graphics to be included on buttons.
  861.  
  862.     Note that you do not need to specify the width and height of buttons. 
  863.     If you are using text labels the button width is determined 
  864.     automatically to accomodate up to 40 characters, and if your are 
  865.     using graphics the button defaults to 20x20. This is the size of 
  866.     the button graphics created by the ICONEDIT program.
  867.  
  868.     Pressing the button is usually done with the mouse cursor, however, 
  869.     you may find it useful to use some other trigger to press the button. 
  870.     The button method "hit()" determines if the mouse cursor is within the 
  871.     boundaries of the button. For a detailed discussion on the use of the 
  872.     mouse functions see the appropriate section of this documentation. If 
  873.     you don't understand all of the functions in this next code fragment 
  874.     you can find explanations elsewhere in this document.
  875.  
  876.     Button mybutton;                       DECLARES INSTANCE OF BUTTON
  877.     mybutton.init(10,10,"EXIT",TEXT);      INITIALIZES MYBUTTON
  878.     mybutton.show();                       DISPLAYS MYBUTTON ON SCREEN
  879.  
  880.     while(!kbhit()) {                      DO THIS WHILE NO KEYS ARE HIT
  881.       if(leftmousekeypressed()) {          IF THE LEFT MOUSE KEY IS
  882.                            PRESSED
  883.         if(mybutton.hit()) {               IF MOUSE CURSOR IS ON MYBUTTON
  884.           mybutton.press();                DISPLAY MYBUTTON AS PRESSED
  885.           while(leftmousekeypressed());    WAIT UNTIL LEFT MOUSE KEY HAS
  886.                            BEEN RELEASED
  887.           mybutton.show();                 DISPLAY MYBUTTON IN NORMAL 
  888.                            STATE
  889.           }
  890.       }
  891.     }                       
  892.  
  893.     Immediately after restoring the button to the normal (undepressed) 
  894.     state the program can branch to take whatever action the button 
  895.     calls for.  By using the Button method "press()" all of the 
  896.     redrawing and repositioning of the text and/or graphic images is 
  897.     handled automatically by the GUI_LIB library.
  898.  
  899. ****************************************************************************
  900.                   COLORBUTTONS
  901. ****************************************************************************
  902.  
  903.     Colorbuttons don't do much except tell you when they are hit and
  904. return their current color. This is very useful if you are coding a paint
  905. program and need some way to set the current foreground and background colors.
  906. I'm sure you can find some other good uses for this class as well.
  907.  
  908.     The header definition of class Colorbutton is:
  909.  
  910.  
  911. class Colorbutton:public Point
  912. {
  913.     protected:
  914.         int color;
  915.         int width;
  916.         int height;
  917.     public:
  918.         void init(int,int,int,int,int);
  919.         void show(int);
  920.         int  hit();
  921.         int getcolor();
  922.         };
  923.  
  924.     Call "init()" with integer parameters for the x and y position,
  925. the width, the height, and the color of the button. Call "show()" with
  926. and integer value representing the color of the rectangle you wish to 
  927. have surrounding the Colorbutton. By manipulating this value you can 
  928. effectively show an "active" Colorbutton in a row of Colorbuttons. "Hit()"
  929. simply returns whether or not the mouse cursor is in the Colorbutton
  930. area, and "getcolor()" return the color of the Colorbutton.
  931.  
  932.     A quick way to make a color selection bar is as follows:
  933.  
  934. Colorbutton colorarray[16];
  935. for(int i=0;i<16;i++) {
  936.     colorarray[i].init(100+(i*20),100,20,20,i);
  937.     colorarray[i].show(15);
  938.     }
  939.  
  940. ****************************************************************************
  941.                  ICONS
  942. ****************************************************************************
  943.  
  944.     Icons can be used in much the same way as buttons. They will always 
  945.     contain a graphic image, although text can be a part of the graphic. 
  946.     They are not 3 dimensional like pushbuttons.
  947.  
  948.     The graphic images for these Icon objects are created using the 
  949.     ICONEDIT program. This program produces 32x32 pixel icons that can be 
  950.     single or multi-framed. More on this in a moment.
  951.  
  952. The definition of the Icon class is:
  953.  
  954. class Icon:public Point
  955. {
  956.     protected:
  957.         int state;                      SELECTED OR NOT
  958.     public:
  959.         void far *picture;              BUFFER CONTAINING GRAPHIC       
  960.     Icon();
  961.     ~Icon();
  962.         void init(int xpos,int ypos,char* fname);
  963.         void show();
  964.         void choose();
  965.         int hit();
  966.         int ispressed();
  967.     };
  968.  
  969.     Like the other graphic objects, the Icon class must first be 
  970.     initialized with a call to "init()." Init() takes three parameter, 
  971.     the x and y coordinates of the upper left corner, and the file name 
  972.     of the file containing the graphic image for the icon. The filename 
  973.     parameter should be given without an extension as the default 
  974.     extension ".ICN" is assumed. The file named in this parameter must 
  975.     exist in the current directory.
  976.  
  977.     Let's look at a short example:
  978.  
  979.     Icon myicon;
  980.     myicon.init(10,10,"paint");
  981.     myicon.show();
  982.  
  983.     This example declares an instance of class Icon using the file 
  984.     "paint.icn" as the graphic, and then displays the icon.
  985.  
  986.     As with the pushbutton, the method "hit()" determines if the 
  987.     mouse cursor is within the boundaries of the icon. If it is, 
  988.     and if a mouse key is pressed, we can change the appearance of 
  989.     the icon to mark it as selected using the method "choose()." Here's 
  990.     a quick example, similar to that presented for the pushbutton:
  991.  
  992.     Icon myicon;
  993.     myicon.init(10,10,"paint");
  994.     myicon.show();
  995.  
  996.     while(!kbhit()) {
  997.         if(leftmousekeypressed()) {
  998.             if(myicon.hit()) {
  999.                 if(!myicon.ispressed()) {
  1000.                     myicon.choose();
  1001.                     while(leftmousekeypressed());
  1002.                     myicon.show();
  1003.                     }
  1004.                 }
  1005.             }
  1006.         }
  1007.  
  1008.     Usually when an icon has been selected you will want to make 
  1009.     sure that the last icon to be selected gets reset to its normal 
  1010.     state with a call to "show()." Whatever action needs to be taken 
  1011.     as a result of the icon's selection can be done after the call to 
  1012.     "choose()." The method "ispressed()" simply returns whether or not 
  1013.     the icon is already displayed in its selected state.
  1014.  
  1015. ****************************************************************************
  1016.                  ACTICONS
  1017. ****************************************************************************
  1018.  
  1019.     Acticons are exactly like Icons except that instead of simply 
  1020.     reversing their image to mark them as the selected icon, they 
  1021.     become animated. Acticons are created using the ICONEDIT program. 
  1022.     They are created in the same manner as an Icon, but instead of just 
  1023.     a single frame graphic, they contain several (up to 32) frames.
  1024.  
  1025. Acticons are defined in the header file as follows:
  1026.  
  1027. class Acticon:public Icon
  1028. {
  1029.     protected:
  1030.         void *picture[32];              GRAPHICS BUFFERS
  1031.         int state;                      SELECTED OR NOT
  1032.         int numpix;                     NUMBER OF FRAMES
  1033.     public:
  1034.         Acticon();
  1035.         ~Acticon();
  1036.         void init(int,int,char*);
  1037.         void show(int);
  1038.         void choose();
  1039.         int ispressed();
  1040.         void animate(int);
  1041.         void backforth(int);
  1042.     };
  1043.  
  1044.  
  1045.     Like Icons, they are initialized with a call to "init()" with 
  1046.     parameters for the upper left x and y coordinates, and the file 
  1047.     name containing the graphic images. When you call "show()", however, 
  1048.     you must supply an integer parameter specifying which frame to 
  1049.     display. Usually you will want to make this frame 0 because if 
  1050.     you call "choose()" the negative image of frame 0 will be displayed 
  1051.     by default.
  1052.  
  1053.     For example:
  1054.     
  1055.     Acticon myicon;
  1056.     myicon.init(10,10,"paint");
  1057.     myicon.show(0);
  1058.  
  1059.     Just like an Icon except for the parameter in the call to "show()." 
  1060.     If you want to use choose to show the reverse image of the Acticon 
  1061.     it is done the same as it is for class Icon. If however you want 
  1062.     to animate the Acticon you must call "animate()" or "backforth()." 
  1063.     Both of these methods will put the Acticon in motion. "Animate()" 
  1064.     will display the frames in ascending order and then restart at 
  1065.     frame 0. "Backforth()" will display the frames in ascending order, 
  1066.     but when it reaches the last frame it will then display the frames 
  1067.     in reverse order back to frame 0. Both of these methods take a 
  1068.     single parameter which specifies the delay between displaying each 
  1069.     frame. This delay is expressed in eighteenths of a second. The 
  1070.     lower the value, the faster the animation. You do not need to 
  1071.     specify the number of frames in the Acticon as this information is 
  1072.     contained in the graphic file created by ICONEDIT. Let's take a look:
  1073.  
  1074.     Acticon myicon;
  1075.     myicon.init(10,10,"paint");
  1076.     myicon.show(0);
  1077.  
  1078.     while(!kbhit()) {
  1079.         if(leftmousekeypressed()) {
  1080.             if(myicon.hit()) {
  1081.                 while(leftmousekeypressed()) 
  1082.                     myicon.animate(3);
  1083.                 }
  1084.             }
  1085.         }
  1086.  
  1087.     In this code fragment, if the left mouse key is pressed while the 
  1088.     cursor is on the Acticon, then the Acticon will animate for as long 
  1089.     as the left mouse key is pressed. Note that "animate()" and 
  1090.     "backforth()" will only change the animation by one frame, so for 
  1091.     continuous motion you must include calls to these methods within 
  1092.     some sort of loop.
  1093.     
  1094. ****************************************************************************
  1095.                  GSTRINGS
  1096. ****************************************************************************
  1097.     
  1098.     No, it's not something a stripper wears, the G in Gstring simply 
  1099.     stands for graphic. These object are used for getting text input 
  1100.     while in graphics mode. They display their own input fields and can 
  1101.     handle all of the text editing keys like arrows, backspace, delete, 
  1102.     etc...
  1103.  
  1104. Class Gstring is defined as:
  1105.  
  1106. class Gstring:public Tstring {
  1107.     protected:
  1108.         int curpos;                     CURSOR POSITION IN STRING
  1109.         int curson;                     CURSOR ON OR OFF
  1110.         void showcurs();
  1111.         void hidecurs();
  1112.     public:
  1113.         void init(int xpos,int ypos,int length,int caps);
  1114.         void show();
  1115.         void input();
  1116.         void get_input();
  1117.         void get_form_input();
  1118.         int isshown();
  1119.         void check_for_blink();
  1120.     };
  1121.  
  1122.     Once again a call to "init()" is necessary to begin. The necessary 
  1123.     parameters are the x and y coordinates of the upper left corner of 
  1124.     the input field, the length of the field, and an integer flag to 
  1125.     indicate whether of not to force the input into all capital letters. 
  1126.     Any nonzero value will force all caps. 
  1127.  
  1128.     Notice that Gstring is not derived from class Point as are all the 
  1129.     other object, but is derived from class Tstring. Tstring is not a 
  1130.     part of this graphics library, but performs the same functions as 
  1131.     Gstring only in text mode.
  1132.  
  1133.     Two methods that are part of Tstring that you might find useful are 
  1134.     "preset()" and "reset()." Call "preset()" with a string parameter 
  1135.     that you wish to have displayed in the input field by default, and 
  1136.     "reset()" with no parameters to clear the input field. For example, 
  1137.     if you wanted the input field to be displayed with the preset value 
  1138.     of "Married" you would use code similar to the following:
  1139.  
  1140.     Gstring mystring;
  1141.     mystring.init(100,10,10,0);
  1142.     mystring.preset("Married");
  1143.     mystring.show();
  1144.  
  1145.     If you don't use the "preset()" method the input field will just 
  1146.     be blank, probably what you want in most cases anyway. To allow 
  1147.     user input just add the statement:
  1148.     
  1149.     mystring.get_input();
  1150.  
  1151.     This will allow text input until the user presses either <ESCAPE> 
  1152.     or <ENTER>. You can test for the <ESCAPE> key with the Tstring 
  1153.     method "escapehit()." Let's put it all together...
  1154.  
  1155.     Gstring mystring;
  1156.     char *the_string;
  1157.  
  1158.     mystring.init(100,10,10,0);
  1159.     mystring.get_input();
  1160.     if(mystring.escapehit())
  1161.         exit(0);
  1162.     else
  1163.     strcpy(the_string,mystring.getstring());
  1164.  
  1165.     The Tstring method "getstring()" returns a char * to the actual 
  1166.     text string that was entered by the user.
  1167.  
  1168. ****************************************************************************
  1169.                GMENUBUTTON and GMENU
  1170. ****************************************************************************
  1171.  
  1172.     The classes Gmenubutton and Gmenu provide the capabilities for you 
  1173.     to include pulldown menus in you graphics applications. The 
  1174.     Gmenubutton is simply the text that will appear in the menu bar 
  1175.     whereas the Gmenu is the moving bar menu that will pop up when a 
  1176.     Gmenubutton is selected. Since these two objects are so closely 
  1177.     related I will discuss them together. Here are the definitions:
  1178.  
  1179. class Gmenu {
  1180.       protected:
  1181.         int on;
  1182.         int x,y,w,h;
  1183.         int num;
  1184.         gitemarray gitems;
  1185.         int menuchoice;
  1186.         int oldbarx,oldbary;
  1187.         void *ptr;
  1188.         void *menubar;
  1189.       public:
  1190.         Gmenu();
  1191.         ~Gmenu();
  1192.         void init(int xloc,int yloc,int numentries,
  1193.                gitemarray gitem);
  1194.         int show();
  1195.         void hide();
  1196.         int isshown();
  1197.       };
  1198.  
  1199. class Gmenubutton {
  1200.         protected:
  1201.           int on;
  1202.           int x,y;
  1203.           int offfgd,offbgd;
  1204.           int onfgd,onbgd;
  1205.           char id[20];
  1206.         public:
  1207.           Gmenubutton();
  1208.           ~Gmenubutton();
  1209.           void init(int xloc,int yloc,int ffgd,int fbgd,
  1210.                 int nfgd,int nbgd,char txt[20]);
  1211.           void show();
  1212.           void press();
  1213.           int hit();
  1214.           };
  1215.  
  1216.     The data element gitemarray is a predefined two dimensional 
  1217.     array containing the strings that will appear in the Gmenu. 
  1218.     The maximum number of items in a Gmenu is 10, and the width of 
  1219.     the pop-up menu is fixed at 100 pixels. When initializing the 
  1220.     strings in the gitemarray always start at index 1 rather than 
  1221.     index 0. Like this:
  1222.  
  1223.     gitemarray menu1array;
  1224.     strcpy(menu1array[1],"ITEM 1");
  1225.     strcpy(menu1array[2],"ITEM 2");
  1226.     etc...
  1227.  
  1228.     A Gmenubutton is initialized with parameters for x and y screen 
  1229.     locations, normal state fgd and bgd colors, selected state fgd 
  1230.     and bgd colors, and the text to be displayed.
  1231.  
  1232.     A Gmenu is initialized with parameters for the x and y screen 
  1233.     locations, the number of entries to be in the menu, and the 
  1234.     gitemarray containing the item strings. The Gmenu is popped-up 
  1235.     with a call to "show()" which returns an integer representing the 
  1236.     index of the gitemarray the bar was on when the selection was made. 
  1237.     If no selection was made "show()" returns 11.
  1238.  
  1239.     Let's look at an example to hopefully clear this all up.
  1240.  
  1241.     gitemarray itemarray;
  1242.     Gmenu mymenu;
  1243.     Gmenubutton mymenubutton;
  1244.     int menuchoice;
  1245.  
  1246.     strcpy(itemarray[1],"ITEM 1");
  1247.     strcpy(itemarray[2],"ITEM 2");
  1248.     strcpy(itemarray[3],"ITEM 3");
  1249.     strcpy(itemarray[4],"ITEM 4");
  1250.  
  1251.     setfillstyle(SOLID_FILL,15);        MAKE A MENU BAR AT TOP OF SCREEN
  1252.     bar(0,0,getmaxx(),10);
  1253.  
  1254.     mymenubutton.init(0,0,0,15,15,0,"MENU 1");
  1255.     mymenubutton.show();
  1256.  
  1257.     mymenu.init(0,11,4,itemarray);
  1258.  
  1259.     if(leftmousekeypressed()) {
  1260.         if(mymenubutton.hit()) {
  1261.             mymenubutton.press();
  1262.             choice=mymenu.show();
  1263.             mymenu.hide();
  1264.             mymenubutton.show();
  1265.             }
  1266.         }
  1267.  
  1268.  
  1269.     In this example the integer variable choice will contain the 
  1270.     number of the item that was selected. Execution can then branch 
  1271.     to the appropriate functions based on this value using case 
  1272.     statements.                    
  1273.  
  1274. **************************************************************************
  1275.                 PRINTING TEXT
  1276. ***************************************************************************
  1277.  
  1278.     Although not part of a class library, there is a text output
  1279. function included in the library that you will find most useful. The
  1280. "outtextxy()" function which is part of the Borland library will only
  1281. take a char* as the parameter to write to the screen. You cannot give
  1282. it a variable to format into a string for you. There is a function in the
  1283. GUI_LIB library called gprintxy() that will format variables into
  1284. printable text for you. The definition is:
  1285.  
  1286.     gprintxy(int,int,char *fmt,...)
  1287.  
  1288.     You can use this function just as you would the "printf()" function
  1289. in text mode. So for example you could write:
  1290.  
  1291.     int age=27;
  1292.     gprintxy(100,100,"%d",age);
  1293.  
  1294.     "gprintxy()" will format the variable and print it to the screen
  1295. correctly. The two integer parameters represent the x and y position to
  1296. print the string. Remember that this function is dependent on the current
  1297. text justification settings. Use the Borland library function 
  1298. "settextjustify()" to alter these settings.
  1299.  
  1300.  
  1301.     Don't forget to use the registration form in the file REGISTER.DOC 
  1302.     to register your copy of this library package. I feel that it is 
  1303.     good quality and very useful software that is well worth the price 
  1304.     that I am asking. 
  1305.  
  1306.          
  1307.  
  1308.     Thank you for using software from David S. Reinhart Associates
  1309.