home *** CD-ROM | disk | FTP | other *** search
/ Teach Yourself Game Programming in 21 Days / TYGAMES_R.ISO / source / day_11 / graph5.h < prev    next >
Text File  |  1994-06-13  |  2KB  |  76 lines

  1.  
  2. // graph5.h //////////////////////////////////////////////////////////////////
  3.  
  4. // D E F I N E S /////////////////////////////////////////////////////////////
  5.  
  6. // global clipping region default value
  7.  
  8. #define POLY_CLIP_MIN_X   0
  9. #define POLY_CLIP_MIN_Y   0
  10.  
  11. #define POLY_CLIP_MAX_X   319
  12. #define POLY_CLIP_MAX_Y   199
  13.  
  14. #define MAX_VERTICES          16   // maximum numbr of vertices in a polygon
  15.  
  16. // S T R U C T U R E S ///////////////////////////////////////////////////////
  17.  
  18. typedef struct vertex_typ
  19.         {
  20.  
  21.         float x,y;        // the vertex in 2-D
  22.  
  23.         } vertex, *vertex_ptr;
  24.  
  25. //////////////////////////////////////////////////////////////////////////////
  26.  
  27. // the polygon structure
  28.  
  29. typedef struct polygon_typ
  30.         {
  31.  
  32.         int b_color;                    // border color
  33.         int i_color;                    // interior color
  34.         int closed;                     // is the polygon closed
  35.         int filled;                     // is this polygon filled
  36.  
  37.         int lxo,lyo;                    // local origin of polygon
  38.         int num_vertices;               // number of defined vertices
  39.         vertex vertices[MAX_VERTICES];  // the vertices of the polygon
  40.  
  41.         } polygon, *polygon_ptr;
  42.  
  43. // P R O T O T Y P E S ///////////////////////////////////////////////////////
  44.  
  45. void Create_Tables(void);
  46.  
  47. void Rotate_Polygon(polygon_ptr poly, int angle);
  48.  
  49. void Scale_Polygon(polygon_ptr poly, float scale);
  50.  
  51. void Translate_Polygon(polygon_ptr poly, int dx,int dy);
  52.  
  53. void Draw_Polygon(polygon_ptr poly);
  54.  
  55. int Clip_Line(int *x1,int *y1,int *x2, int *y2);
  56.  
  57. void Draw_Polygon_Clip(polygon_ptr poly);
  58.  
  59. void Bline(int xo, int yo, int x1,int y1, unsigned char color);
  60.  
  61. void Draw_Boundary(int color);
  62.  
  63. // G L O B A L S  ////////////////////////////////////////////////////////////
  64.  
  65. extern float sin_look[],   // look up tables for sin and cosine
  66.              cos_look[];
  67.  
  68. // the clipping region, set it to default on start up
  69.  
  70. extern int poly_clip_min_x,
  71.            poly_clip_min_y,
  72.            poly_clip_max_x,
  73.            poly_clip_max_y;
  74.  
  75.  
  76.