All pastes #183676 Raw Edit

Mine

public c v1 · immutable
#183676 ·published 2006-09-27 03:05 UTC
rendered paste body
#include <stdio.h>       #include <stdlib.h>      #include <string.h> /*// Sometimes glu.h includes glut.h--sometimes not.*/#ifdef MAC_OSX#    include <OpenGL/glu.h>#    include <GLUT/glut.h>#else #    include <GL/glu.h>       #    include <GL/glut.h>       #endif/* -------------------------------------------------------------------------- */// Function Declarationsstatic 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 Declarationsstatic 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)  {    }/*  /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\   */