home *** CD-ROM | disk | FTP | other *** search
/ The Education Master 1994 (4th Edition) / EDUCATIONS_MASTER_4TH_EDITION.bin / files / progmisc / bgidraw / bgidraw.exe / lha / HOWTO.DOC < prev    next >
Text File  |  1993-05-03  |  9KB  |  205 lines

  1.  
  2.  
  3.                               How To Use BGI-Draw
  4.  
  5.              Start BGI-Draw like any DOS-based program by typing BD at
  6.          the  DOS  prompt,  or  from  within  a  batch  file.  You can
  7.          optionally  follow  BD  with  a  space  and  a  filename   to
  8.          immediately  start editing or creating a file.
  9.  
  10.                                 C/C++ or Pascal
  11.  
  12.              If  the  file  is  a  new  one, BD will try to guess what
  13.          language you are using by the extension of the filename.   If
  14.          your  file ends in .CPP, or .C, it will create C source code.
  15.          If .PAS, then a pascal source file will be created.   If  you
  16.          use  any other extension, then you will be asked to pick your
  17.          language.
  18.  
  19.          NOTE: PASCAL PROGRAMMERS, if the first letter  of  your  file
  20.          extension  is  C, then BD will think you want a C source code
  21.          file.
  22.  
  23.                                   Video Modes
  24.  
  25.             A menu will appear listing the video  modes  supported  by
  26.          your computer.  (If you have Hercules, no menu appears, since
  27.          your computer supports only one graphics mode.) Pick the same
  28.          mode as your finished program will  be  using.   If  you  are
  29.          developing  a  program  for  EGA, then you don't want to draw
  30.          your picture in VGA graphics.
  31.  
  32.                                  The Main Menu
  33.  
  34.             Then the main menu appears.  It consists  of  30  colorful
  35.          icons, which can be pointed to with the mouse or arrow keys.
  36.  
  37.                               To Use The Keyboard
  38.  
  39.             If  you  don't have a mouse, or if you want to control the
  40.          program from the keyboard, you'll notice that the  arrow  and
  41.          other  movable  objects  in  BGI-Draw  can be moved with  the
  42.          arrow keys.  You can also use [Home], [Pg Up], [Pg  Down]  or
  43.          [End] to move diagonally.  When the [Num Lock] key is on, the
  44.          number keys move the arrow in large jumps, for fast access to
  45.          any area of the screen.
  46.  
  47.                                   Conventions
  48.  
  49.             There  are several occasions in which the program will ask
  50.          for a yes or no answer.  To answer yes, you  can  press  [y],
  51.          [Enter]  or  the left mouse button.  To answer no, press [n],
  52.          [Esc] or the right mouse button.
  53.  
  54.             When  asked  to  type a number or string, the mouse has no
  55.          effect  in  some  dialogs,  so you must use [Enter] or [Esc].
  56.          [Enter] generally indicates you want the  program  to  accept
  57.          what  you have typed, and [Esc] means you want to abandon the
  58.          current operation.
  59.  
  60.                                  Saving Files
  61.  
  62.             BGI-Draw updates the source code file on the fly,  meaning
  63.          that  as  soon  as  you perform an operation, the source code
  64.          file is updated.  "Saving" the file is not  required  and  no
  65.          specific save function is provided.
  66.  
  67.                      Using The Files In Your Own Programs
  68.  
  69.             We  assume  you  have  done enough graphics programming to
  70.          realize the importance of BGI-Draw.  If so, you'll also  know
  71.          how  to  initialize  a  graphics mode within your program and
  72.          create/use integer variables.  The  source  code  created  by
  73.          BGI-Draw  is purely on-screen graphics, without the necessary
  74.          start-up code, optional TPU or OBJ headers, etc.  You  simply
  75.          cut  and  paste  it  into  your program source code with your
  76.          favorite programming environment or text editor. Briefly:
  77.  
  78.                                      C/C++
  79.  
  80.              You'll need GRAPHICS.LIB, GRAPHICS.H, and  possibly  some
  81.          .BGI  and  .CHR  files available where your compiler can find
  82.          them. The *.BGI files are the drivers  for  various  graphics
  83.          modes,  and  the  *.CHR files are fonts.  Default Font, (font
  84.          #0) is built-in. These can also  be  incorporated  into  your
  85.          .EXE  files  by  creating  .OBJ  files  from  them.  See your
  86.          Borland manuals, or purchase C-Magic from Another Company  if
  87.          you want stand-alone .EXE files.
  88.  
  89.              Create  a  project  file  including your main source code
  90.          file and GRAPHICS.LIB.  At the top of your main file add  the
  91.          line:
  92.  
  93.          #include "graphics.h"
  94.  
  95.          create variables graphdetect, and graphmode as integers.
  96.  
  97.          Assign values to  graphdetect  and  graphmode  to  start  the
  98.          proper video mode.  See the chart below.
  99.  
  100.          Use initgraph as in the following example:
  101.  
  102.          #include "graphics.h"
  103.          int graphdetect, graphmode;
  104.          int vx, vy;
  105.          void main(){
  106.             graphdetect = 6;
  107.             graphmode = 2;
  108.             initgraph(&graphdetect, &graphmode,"");
  109.             vx = 0;
  110.             vy = 0;
  111.             /* put your picture source code  here */
  112.             /* see Movable Pictures below */
  113.          }
  114.  
  115.  
  116.                                     Pascal
  117.  
  118.              You'll need GRAPH.TPU, (or GRAPH.TPP), and possibly  some
  119.          .BGI  and  .CHR  files available where your compiler can find
  120.          them. The *.BGI files are the drivers  for  various  graphics
  121.          modes,  and  the  *.CHR files are fonts.  Default Font, (font
  122.          #0)  is  built-in.  These  can also be incorporated into your
  123.          .EXE files by  creating  .OBJ  files  from  them.   See  your
  124.          Borland  manuals,  or  purchase  Pascal  Magic  from  Another
  125.          Company if you want stand-alone .EXE files.
  126.  
  127.          Create a main source code file with GRAPH in the USES line.
  128.  
  129.          create variables graphmode, and graphdetect as integers.
  130.  
  131.          Assign  values  to  graphmode  and  graphdetect  to start the
  132.          proper video mode.  See the chart below.
  133.  
  134.          Use initgraph as in the following example:
  135.  
  136.          program blahblah;
  137.          uses graph;
  138.          var
  139.             graphdetect, graphmode : integer;
  140.             vx, vy : integer;
  141.          begin
  142.             graphdetect := 1;
  143.             graphmode := 0;
  144.             initgraph(graphdetect,graphmode,'');
  145.             vx := 0;
  146.             vy := 0;
  147.             (* put your picture source code here *)
  148.          end;
  149.  
  150.                                 Movable Pictures
  151.  
  152.          You'll notice integer  variables  vx  and  vy  in  the  above
  153.          examples.  Because you may want to make movable pictures  for
  154.          your  program, all horizontal locations are prefaced with "vx
  155.          +" and all vertical  locations  are  prefaced  with  "vy  +".
  156.          Normally,  you'd  make sure vx and vy are both 0, so that the
  157.          picture shows on the screen exactly like you have made it  in
  158.          BGI-Draw.   But  for  animations,  split  screens,  or pop-up
  159.          icons, etc, you'll want to control vx and  vy  to  move  your
  160.          pictures around.
  161.  
  162.                Graphdetect and Graphmode for Various Video Modes
  163.  
  164.          BGI-Draw Mode  Name   Size       Colors Graphdetect Graphmode
  165.          1              CGA    640 x 200  2      1           4
  166.          2              CGA    320 x 200  4      1           0
  167.          3              EGA    640 x 200  16     4           0
  168.          4              EGA    640 x 350  16     3           1
  169.          5              Herc   720 x 348  2      7           0
  170.          6              VGA    640 x 480  16     6/9         2
  171.          7              VGA    320 x 200  256    16*         0
  172.          8              SVGA   640 x 480  256    16*         *
  173.  
  174.          *  Borland  does  not supply drivers for 256-color modes, but
  175.          many third party drivers are available.  Most use  16  for  a
  176.          graphdetect number.  In the case of SVGA modes, the Graphmode
  177.          number will vary with the manufacturer of the driver.
  178.  
  179.                                     Summary
  180.  
  181.              Simply start BD, answer the questions, and start drawing.
  182.          Most  of  the  drawing  tools work just like the tools in any
  183.          drawing or paint program, except there are  also  some  tools
  184.          you've probably never seen before.  (Relax, you don't have to
  185.          learn  to work all the tools to use this program!) When done,
  186.          simply quit the program, and you'll have a source  code  file
  187.          which you can incorporate into your program.
  188.  
  189.                                 Space and Strip
  190.  
  191.             Included  in  your BGI-Draw package are two small programs
  192.          called SPACE.EXE and STRIP.EXE which can be  used  to  change
  193.          the indentation of lines in a source code file.  When you cut
  194.          and  paste bits of source code together from different files,
  195.          it is nice to be able to achieve the same indentation without
  196.          adding or  removing  spaces  line  by  line.   To  use  these
  197.          programs  simply  call  them  by  name  at the DOS prompt and
  198.          follow the on-screen directions.
  199.  
  200.             See  the  next  chapter to find out about all the features
  201.          available within BGI-Draw, and how to use them.
  202.  
  203.          _____________________________________________________________
  204.                                                           End of file.
  205.