/*Steven Spivack
 * CpSc 1011 Section 5
 * Oct 27, 2022
 * Lab 9A
 * This file calls functions defined in other files
 * and executes them to print the Irsih flag.
 * This file also gathers user information and calculates
 * the size requirements for the flag.
 * */






#include "defs.h"

//----------------------------------------------------------------------
// Main Function
int main (void){
	int width, height, i, j, k = 0;
	int userInput, flagSize;
	fprintf(stderr, "\n\nFlag of Ireland");
	fprintf(stderr, "\n\tWhat width do you want the flag to be? ");

// Get the User's Input for Width

	userInput = getWidth();	

// Calculate the Size for Flag

	width = userInput;
	height = width / 2;
	flagSize = height * width * 3;

	fprintf(stderr, "\n\nMaking the flag with width %d & height %d ...", width, height);
	fprintf(stderr, "\n\n");

// Set Size Values to Header Struct
	
	header size;
	size.width = width;
	size.height = height;
	size.maxColor = 255;

// Call Functions
	
	pixel flag[flagSize];	
	
	writeHeader(size);

	fillFlagArray(flag, width, height);

	writePixels(flag, width, height, flagSize);

	return 0;
}


