#ifndef FB_H
#define FB_H

extern int fb_xl;
extern int fb_xr;
extern int fb_yt;
extern int fb_yb;


/*
	For simple polygons, the poly struct simply contains the list
	of x,y pairs of the vertices.  Note, the starting vertex and
	the ending vertex have the same coordinates.  With a limit
	of 100 pairs, we can only represent a poly with 99 sides.

  */

struct poly_type
{
	double x[100];
	double y[100];
	int n; // counts the number of vertices in the list

	poly_type() { n = 0; status = 0; }

	int status;  // 0 = empty, 1 = unfinished, 2 = finished
	             // indicates whether the poly is complete

	void clear() {n = 0; status = 0; }
	void add_pair(double px, double py) { status = 1; x[n] = px; y[n] = py; n++; }
	void close() { add_pair(x[0], y[0]); status = 2; }
};

// this is the prototype for your clipper
void
myClipper(poly_type clip_result[100], int *num_polies, poly_type input_poly, int xl, int xr, int yt, int yb);

// this is the prototype for your fill rasterizer
void
myFillRasterizer(poly_type *input_polies, int num_polies);

// this is the prototype for your line rasterizer
void
myLineRasterizer(poly_type *input_polies, int num_polies);

void
fbSetPixel(int i, int j, double r, double g, double b);

void
fbClear(double r, double g, double b);

#endif
