/*program to draw filled areas */ #include int contrl[12], intin[256], ptsin[256], intout[256], ptsout[256]; int pxy[256],nxy[256],txy[256]; /* Arrays for the differences of the polygon points */ int t2xy[256],t3xy[256],t4xy[256]; int t5xy[256],t6xy[256],t7xy[256]; int t8xy[256],t9xy[256]; /* Arrays for the polygon points */ int n2xy[256],n3xy[256],n4xy[256],n5xy[256]; int n6xy[256],n7xy[256],n8xy[256],n9xy[256]; /* Arrays for the something or other... */ int del[256],rem[256]; int del2[256],rem2[256],del3[256],rem3[256]; int del4[256],rem4[256],del5[256],rem5[256]; int del6[256],rem6[256],del7[256],rem7[256]; int del8[256],rem8[256],del9[256],rem9[256]; int temp1,temp2,temp3; int x_boundary; int num_animate,infloop,inflag; char buffer[32767]; int handle,ntween; int kstate,dummy,mx,my; int nbut,i,p,num; int height,width; long screen1,screen2,orgscrn,temp; main() { ntween=32; /* Set the system up to do GEM calls*/ appl_init(); /* Get the handle of the desktop */ handle=graf_handle(&width,&height,&dummy,&dummy); /* Open the workstation. */ for (i=1; i<10; ++i) intin[i] = 1; intin[10] = 2; v_opnvwk(intin, &handle, intout); x_boundary=intout[0]; screen1=Physbase(); orgscrn=screen1; screen2=(0xffff00&buffer); screen2+=(0x100); /* Now do setup stuff */ v_clrwk(handle); v_hide_cursor(handle); v_gtext(handle,0,height*1,"Polygon animation program by Leonard Tramiel."); v_gtext(handle,0,height*2,"Additions and comments by Alex Leavens."); v_gtext(handle,0,height*3,"This program lets you draw a series of polygons"); v_gtext(handle,0,height*4,"using the mouse. It then animates the polygons"); v_gtext(handle,0,height*5,"through each step. To enter the first poly,"); v_gtext(handle,0,height*6,"use the mouse, and button. When you're ready"); v_gtext(handle,0,height*7,"to enter the last point, hold down the SHIFT"); v_gtext(handle,0,height*8,"key before pressing the mouse button. On all"); v_gtext(handle,0,height*9,"subsequent polygons, the program remembers"); v_gtext(handle,0,height*10,"how many vertices are needed (each polygon"); v_gtext(handle,0,height*11,"must have the same number of vertices.)"); v_gtext(handle,0,height*12,"Smaller polys will animate faster!"); v_gtext(handle,0,height*20,"Press mouse button to begin..."); v_gtext(handle,0,height*14,"Click mouse button on left half of screen"); v_gtext(handle,0,height*15,"for single animation, on right half for"); v_gtext(handle,0,height*16,"infinite loop..."); v_gtext(handle,0,height*18,"NOTE:currently you MUST enter 8 polys."); v_show_cursor(handle,0); evnt_button(1,1,1,&mx,&my,&dummy,&dummy); evnt_button(1,1,0,&dummy,&dummy,&dummy,&dummy); temp1=x_boundary/2; inflag=0; if(mx>temp1) inflag=1; vsf_perimeter(handle,1); do { graf_mouse(256,&dummy); v_clrwk(handle); graf_mouse(257,&dummy); graf_mouse(0,i); /* Get the first polygon here... */ i=0; do { evnt_button(1,1,1,&mx,&my,&dummy,&kstate); pxy[i++]=mx; pxy[i++]=my; graf_mouse(256,&dummy); v_clrwk(handle); v_pline(handle,i/2,pxy); graf_mouse(257,&dummy); evnt_button(1,1,0,&mx,&my,&dummy,&dummy); } while (kstate!=2); /* Get the second polygon... */ num=i; i=0; do { evnt_button(1,1,1,&mx,&my,&dummy,&kstate); nxy[i++]=mx; nxy[i++]=my; graf_mouse(256,&dummy); v_clrwk(handle); v_pline(handle,i/2,nxy); graf_mouse(257,&dummy); evnt_button(1,1,0,&mx,&my,&dummy,&dummy); } while (i