/* * grafx.c * GloveNet Version 2.0 * */ #include #include "powerglove.h" #include "all-bot.h" #include "colors.h" float view_distance, field_of_view, near_clipping_plane, far_clipping_plane, aspect_ratio; float azim, inc, rotation; char char_usx[5], char_themx[5]; pglove_data us; pglove_data them; int us_count, them_count; pglove_data foo,bar; grafix_main() { #ifdef DBUG printf("Start grafix_main\n"); #endif init(); while(1) { /* intake(5, 5,5,5, 5,5,5,5, 5,5, US); intake(5, 5,5,5, 5,5,5,5, 5,5, THEM); */ bar.x = intake_from_get(); /* bar.x = intake(1, 1,1,1, 1,1,1,1, 1,1, 3); foo.x = intake(1, 1,1,1, 1,1,1,1, 1,1, 4); */ /* printf(" bar.x = %i foo.x = %i \n", bar.x, foo.x); */ /* printf(" US: %i %i %i %i %i %i %i %i %i %i\n", us_count, us.x, us.y, us.z, us.thumb, us.one, us.two, us.three, us.twist, us.key); printf("THEM: %i %i %i %i %i %i %i %i %i %i\n", them_count, them.x, them.y, them.z, them.thumb, them.one, them.two, them.three, them.twist, them.key); */ pushmatrix(); c3i(black); clear(); sprintf(char_usx, "%i", bar.x); sprintf(char_themx, "%i", foo.x); cmov(0,0,0); c3i(brick); charstr(char_usx); cmov(5,0,0); c3i(white); charstr(char_themx); linewidth(5); draw_mark(us.x, us.y, us.z, 40); swapbuffers(); popmatrix(); } } draw_mark(x,y,z,size) int x,y,z,size; { move(x-size, y, z); draw(x+size, y, z); move(x, y-size, z); draw(x, y+size, z); move(x, y, z-size); draw(x, y, z+size); } intake( count, x, y, z, thumb, one, two, three ,twist, key, from ) int count, x,y,z, thumb,one,two,three,twist,key; int from; { #ifdef DBUG printf(" intake: %i %i %i %i %i %i %i %i %i %i from= %i\n", count, x,y,z, one,two,three, twist,key, from); #endif switch( from ) { case US: us_count = count; us.x = x; us.y = y; us.z = z; us.thumb = thumb; us.one = one; us.two = two; us.three = three; us.twist = twist; us.key = key; /* printf(" US: %i %i %i %i %i %i %i %i %i %i\n", us_count, us.x, us.y, us.z, us.thumb, us.one, us.two, us.three, us.twist, us.key); */ break; case THEM: them_count = count; them.x = x; them.y = y; them.z = z; them.thumb = thumb; them.one = one; them.two = two; them.three = three; them.twist = twist; them.key = key; /* printf("THEM: %i %i %i %i %i %i %i %i %i %i\n", them_count, them.x, them.y, them.z, them.thumb, them.one, them.two, them.three, them.twist, them.key); */ break; case 3: return(us.x); break; case 4: return(them.x); break; default: printf(" intake error/n"); break; } } init() { keepaspect(1,1); /* prefposition(10, 990, 10, 990); */ prefposition(10, 990, 600, 990); winopen(""); wintitle("******** GloveNet *******"); doublebuffer(); RGBmode(); gconfig(); zbuffer(TRUE); mmode(MVIEWING); view_distance = 200.0; field_of_view = 600.0; near_clipping_plane = 0.1; far_clipping_plane = 800.0; aspect_ratio = 1.0; azim = 0.0; inc = 0.0; rotation = 0.0; perspective(field_of_view, aspect_ratio, near_clipping_plane, far_clipping_plane); polarview(view_distance, azim, inc, rotation); }