home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / v / vpoint.zip / AJGFUN.H next >
C/C++ Source or Header  |  1993-01-23  |  5KB  |  195 lines

  1.  
  2. /* --------------------------------------------------------------------------
  3.  
  4.  AJGFUN.H -- (AJ's graphics functions header file)
  5.          Function prototypes and typedefs for GRAPHICS program utilities
  6.  
  7.      Written by Arthur Dunphy Jr.  Spring 1992 in Microsoft QuickC v2.51
  8.      Portions copyright Microsoft Corp.
  9.  
  10.  --------------------------------------------------------------------------- */
  11.  
  12.  
  13. #ifndef NUMFUN_DEFINED
  14. #define NUMFUN_DEFINED
  15.  
  16. typedef unsigned long color_t; /// color values for palette remapping
  17.  
  18. /* Macro for setting a VGA color, each element has range 0 through 63 */
  19. #define rgb( r, g, b )          \
  20.     (((( (color_t)(b) ) << 16 )    \
  21.     | ( (color_t)(g) ) << 8        \
  22.     | ( (color_t)(r) )) & 0x3F3F3FL )
  23.  
  24. struct color_struct
  25.     {
  26.     color_t  r, g, b;
  27.     };
  28.  
  29. typedef struct color_struct color_s;
  30.  
  31. /* Macro same as above but takes color_struct as argument */
  32. #define rgb2( color )          \
  33.     (((( (color_s)(color.b) ) << 16 )    \
  34.     | ( (color_s)(color.g) ) << 8        \
  35.     | ( (color_s)(color.r) )) & 0x3F3F3FL )
  36.  
  37.  
  38. /* Another Macro for mixing Red, Green, and Blue elements of color */
  39. #define RGB(r,g,b) (((color_t) ((b) << 8 | (g)) << 8) | (r))
  40.  
  41. typedef int           mouse_t; /// for variables involved in mouse functions
  42.  
  43. typedef unsigned long key_t;   /// for storing key-press ascii codes
  44.  
  45. /* The following are just some descriptive names to make branching and
  46.    looping statements more readable */
  47.  
  48. #define TRUE    1
  49. #define FALSE   0
  50. #define ON      1
  51. #define OFF     0
  52. #define YES     1
  53. #define NO      0
  54. #define GOOD    1
  55. #define BAD     0
  56. #define BEGIN   1
  57. #define END     0
  58. #define GO      1
  59. #define NOGO    0
  60.  
  61. #define EQ       ==
  62. #define NE       !=
  63. #define UNABLETO !
  64. #define CANT     !
  65. #define NOT      !
  66. #define THEN
  67. #define AND      &&
  68. #define OR       ||
  69.  
  70. #define BINARY  2
  71. #define DECIMAL 10
  72. #define HEX     16
  73.  
  74. /* Constants for brush patterns for cad?.c */
  75. #define DOT 1
  76. #define SLASH 2
  77. #define BACKSLASH 3
  78. #define SPRAY 4
  79. #define CUSTOMIZED 8
  80.  
  81.  
  82. typedef signed char boolean;
  83.  
  84. typedef short pixtype;   /// logical pixel coordinate type
  85.  
  86. struct pos_struct
  87. /// Structure to define variables needed for drawing squares
  88.       {
  89.     pixtype  xpos;   /// x and y logical coordinates
  90.     pixtype  ypos;
  91.     pixtype  width;  /// Width and height of each square
  92.     pixtype  height;
  93.     int      num;    /// Character to be drawn inside square
  94.     boolean  used;   /// Flag for if a number has been picked already
  95.       } ;
  96.  
  97. struct pos_struct posarray[4][10];
  98. /// Dimensions of grid of squares to be drawn
  99.  
  100. struct rect_struct       /// defines logical coordinates of a rectangle
  101.       {
  102.       pixtype x1;
  103.       pixtype y1;
  104.       pixtype x2;
  105.       pixtype y2;
  106.       } ;
  107.  
  108. typedef struct rect_struct rect_s;
  109.  
  110.  
  111. struct videoconfig vc; /// video configuration variables, eg. # of pages available
  112.  
  113. struct _fontinfo fi; /// font information variables, eg. width of character.
  114.  
  115. /// Constants for the following function
  116. #define NOFILL 0
  117. #define FILL   1
  118.  
  119. /* Basically the same as QuickC _rectangle(), but takes a rect_struct as the
  120.    argument.  This is easier to program when drawing large numbers of
  121.    rectangles which must be updated, or changed somehow, frequently. */
  122. void drawrect(boolean fill, rect_s * rect);
  123.  
  124. /* Sets the logical x-y coordinates in graphics modes to the center of the
  125.    screen, eg 640 * 380 mode will _setlogorg() to ( 319, 179 ). */
  126. void set_center_origin(void);
  127.  
  128. void getdate(char * datestr, time_t days);
  129.  
  130. boolean set_font(short font, short size);
  131.  
  132. void int_to_s(short nums[7], char list[20]);
  133.  
  134. void remap(short x1, short x2, short y1, short y2);
  135.  
  136. void remap2(short x1, short y1, short x2, short y2, short maptype);
  137.  
  138. enum FONTS { COUR = 1, HELV, TRMN, MOD, SCRP, ROM , HELVE, HELVF, TRMNE, \
  139.          TRMNF, VGAFIX, VGAOEM, VGASYS};
  140.  
  141. typedef enum FONTS fonts;
  142.  
  143.  
  144.  
  145. #define PURPLE    0x331436
  146. #define LT_GREEN  0x213907
  147. #define LT_BLUE   0x3D2407
  148. #define OFF_RED   0x1E0038
  149.  
  150.  
  151.  
  152. /*unsigned long color_array[16] =
  153.     {_BLACK, _BLUE, _GREEN, _CYAN, _RED, _GRAY,
  154.     LT_BLUE, _WHITE, OFF_RED, PURPLE, _LIGHTGREEN,
  155.     _LIGHTCYAN, _LIGHTRED, _LIGHTMAGENTA, LT_GREEN,
  156.     _BRIGHTWHITE}; */
  157.  
  158. #define $BLACK    0
  159. #define $BLUE     1
  160. #define $GREEN    2
  161. #define $CYAN     3
  162. #define $RED      4
  163. #define $GRAY     5
  164. #define $LT_BLUE  6
  165. #define $WHITE    7
  166. #define $OFF_RED  8
  167. #define $PURPLE   9
  168. #define $LT_GREEN 10
  169. #define $LT_CYAN  11
  170. #define $LT_RED   12
  171. #define $LT_MAG   13
  172. #define $LIGHTG   14
  173. #define $BR_WHITE 15
  174.  
  175. void cycle(short n, short type, short r, short g, short b)  ;
  176.  
  177. void sort(int * x, int n);
  178.  
  179. /* Accepts a character string and returns, depending on the video mode and
  180.    the current character font, the logical x coordinate to center the string
  181.    in the middle of the screen */
  182. pixtype centerx(char * s);
  183.  
  184.  
  185. void mixall(void);
  186.  
  187. boolean regfonts(void); /// Expanded version of _registerfonts() function from
  188.             /// QuickC. Provides more error checking. Returns 0 if
  189.             /// font files cannot be located, TRUE otherwise.
  190.  
  191. unsigned long get_color(int *type, int *r, int *g, int *b);
  192. boolean reset_mouse( void );
  193.  
  194. #endif
  195.