#include #include #include /* // Sometimes glu.h includes glut.h--sometimes not. */ #ifdef MAC_OSX # include # include #else # include # include #endif /* -------------------------------------------------------------------------- */ // Function Declarations static void parseFile(); static void saveFile(); static void display_CB(void); static void key_CB(unsigned char key, int x, int y); static void mouse_CB(int button, int state, int x, int y) /* -------------------------------------------------------------------------- */ // Instance Variable Declarations static int lines[1000][2][3]; static int size; static int c_angle; /* -------------------------------------------------------------------------- */ int main(int argc, char *argv[]) { int win; int submenu; glutInit(&argc, argv); /* initialize GLUT system */ glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE); glutInitWindowSize(800, 600); win = glutCreateWindow("Assignment 2"); /* create window */ /* set background to black */ glClearColor((GLclampf)0.0,(GLclampf)0.0,(GLclampf)0.0,(GLclampf)0.0); gluOrtho2D(0.0, 630.0, 0.0, 630.0); /* how object is mapped to window */ glutDisplayFunc(display_CB); /* set window's display callback */ glutKeyboardFunc(key_CB); /* set window's key callback */ glutMouseFunc(mouse_CB); /* set window's mouse callback */ parseFile(); // Read in any predone code glutMainLoop(); /* start processing events... */ /* Execution never reaches this point, so return value is failure */ return 1; } static void parseFile() { if(!isatty(fileno(stdin))) { char* temp[500]; while( fgets(temp, 500, stdin) != NULL) { //Tokenize temp //Check if first word is Line //Pull Values //Insert values into two matrices //Inc Size size++; } } } static void saveFile() { int i = 0; for(i = 0; i < size; i++) { printf("%s", commands[i]); } } static void drawLines() { } static void drawGun() { } /* /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ */ /* // Function called whenever redisplay needed (try hiding the window and then // exposing it. The debug macro should print something.) */ static void display_CB(void) { glClear(GL_COLOR_BUFFER_BIT); /* clear the display */ drawLines(); if( mode == 1) drawGun(); glEnd(); /* OpenGL draws the filled triangle */ glFlush(); /* Complete any pending operations */ glutSwapBuffers(); /* Make the drawing buffer the frame buffer and vice versa */ } /* /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ */ /* Function called on key press */ static void key_CB(unsigned char key, int x, int y) { if( key == 'q' ) { saveFile(); exit(0); } else if( key == 'w' ) { //cmSize--; display_CB(); } } /* /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ */ /* Function called on mouse click */ static void mouse_CB(int button, int state, int x, int y) { } /* /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ */