home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progbas / hgclib.arj / HGCLIB.DOC < prev   
Encoding:
Text File  |  1991-03-29  |  3.6 KB  |  126 lines

  1. Turbo Basic Hercules Graphics Card Library
  2. ==========================================
  3.  
  4.                    By
  5.            Maximillian Habibi.
  6.  
  7. The Turbo Basic HGC Library is designed for use in programs requiring
  8. graphics output on a Hercules Monochrome Graphics Card.  It requires
  9. that you have a genuine HGC or compatible graphics card.  No VGA/EGA
  10. emulations allowed!  The library adds a few subroutines performing
  11. similar TB functions on the card.  The subroutines are:
  12.  
  13. HGRAPH     - Switches to Hercules Graphics mode using page 1.
  14.  
  15. HTEXT      - Switches back to text mode using page 0.
  16.  
  17. HCLR       - Clears the graphics screen.
  18.  
  19. HPSET      - Like the normal PSET command.  Plots a point at specified
  20.              location.
  21.  
  22. HLINE      - Draws a line between the specified points.
  23.  
  24. HBOX       - Draws a box of the given dimensions.
  25.  
  26. HCIRCLE    - Draws a circle of the given radius at the specified
  27.              location.
  28.  
  29. HPRINT     - Prints text in graphics mode at the specified location.
  30.  
  31. To use the subroutines in your program, HGCLIB.BAS must be in the TB
  32. working directory.  Add the following line to the beginning of your program:
  33.  
  34. $INCLUDE "HGCLIB.BAS"
  35.  
  36. When compiled, your program will have the subroutines "built-in" to it.
  37. To call the subroutines, you need to use the CALL statment, with the
  38. needed parameters (if any).
  39.  
  40. CALL <subroutine>(parameters)
  41.  
  42. The parameters that they need are as follows:
  43.  
  44. CALL HGRAPH
  45.  
  46. Needs no parameters.
  47.  
  48. CALL HTEXT
  49.  
  50. Needs no parameters.
  51.  
  52. CALL HCLR
  53.  
  54. Needs no parameters.
  55.  
  56. CALL HPSET(x%,y%,c%)
  57.  
  58. x% is the X location (0-719), y% is the Y location (0-347) and c% is
  59. the colour (0=black, 1=white).
  60. Example:
  61.  
  62. CALL HPSET(10,100,1)
  63.  
  64. Plots a point at X 10  Y 100 in white.
  65.  
  66. CALL HLINE(x1%,y1%,x2%,y2%,c%)
  67.  
  68. x1% is the X starting location, y1% is the Y starting location, x2% is
  69. the X destination location, y2% is the Y destination location and c% is
  70. the colour, 0 or 1.
  71. Example:
  72.  
  73. CALL HLINE(20,50,500,300,1)
  74.  
  75. Draws a line from X 20  Y 50 to X 500  Y 300 in white.
  76.  
  77. CALL HBOX(x1%,y1%,x2%,y2%,c%)
  78.  
  79. x1% and y1% are the co-ordinates for the top left corner, x2% and y2%
  80. are the co-ordinates for the bottom right corner, c% is the colour, 0
  81. or 1.
  82. Example:
  83.  
  84. CALL HBOX(20,20,300,300,1)
  85.  
  86. Draws a box with top left corner at: X 20  Y 20 and bottom right corner
  87. at: X 300  Y 300 in white.
  88.  
  89. CALL HCIRCLE(a%,b%,r%,e,c%)
  90.  
  91. a% and b% are the co-ordinates for the circle's centre, r% is the
  92. radius, e is the eccentricity of the circle by changing the ratio of X
  93. to Y.  Because the HGC's pixels are rectangular, a ratio of 1 will give
  94. a tall ellipse.  0.75 or 0.5 should be ok for a circle.  c% is the
  95. colour, 0 or 1.
  96. Example:
  97.  
  98. CALL HCIRCLE(50,50,120,.75,1)
  99.  
  100. Draws a circle at X 50  Y 50 with a radius of 120 pixels.  A ratio of
  101. 0.75, giving a rough circle and drawn in white.
  102.  
  103. CALL HPRINT(r%,c%,s$)
  104.  
  105. r% is the row, c% is the column and s$ is the string to print.  Note
  106. the screen in garphics mode holds 90 columns by 34 rows.
  107. Example:
  108.  
  109. CALL HPRINT(25,50,"Hello!")
  110.  
  111. Prints Hello at location row: 25 column: 50.
  112.  
  113.  
  114. N.B.  After the program has finished, or graphics is no longer needed,
  115. The command CALL HTEXT MUST be issued, otherwise the program will
  116. appear to crash the system.  What is actually happening is, the text is
  117. going to the text screen, and you are looking at the graphics screen,
  118. so you don't see it!
  119. Also, before you use the graphics screen you must clear it with CALL
  120. HCLR otherwise it will be full of garbage and previous graphics,
  121. rendering it unusable.
  122.  
  123. These Turbo Basic routines should be useful to many people, have fun!
  124.  
  125.     Maximillian Habibi.
  126.