void read_input() { int i; double w; freopen("cube.txt","r",stdin); w = 0.08; scanf("%d",&no_ver); //total no of vertices scanf("%d",&no_planes); //total no of planes for(i=0;i<no_ver;i++) //scan all vertex co-ordinate { scanf("%lf %lf %lf",&ver[i][0], &ver[i][1], &ver[i][2]); ver[i][0] /= w; ver[i][1] /= w; ver[i][2] /= w; tmp_ver[i][0] = ver[i][0] ; tmp_ver[i][1] = ver[i][1] ; tmp_ver[i][2] = ver[i][2] ; } for(i=0;i<no_planes;i++) //scan all plane points { scanf("%d",&planes[i][0]); scanf("%d",&planes[i][1]); scanf("%d",&planes[i][2]); scanf("%d",&planes[i][3]); } init_balls(); }
void setup() { glClearColor(0.0, 0.0, 0.0, 1.0); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(-RADIUS, RADIUS, -RADIUS, RADIUS, -RADIUS, RADIUS); glEnable(GL_DEPTH_TEST); glShadeModel(GL_SMOOTH); init_light(GL_LIGHT0, 0, 1, 1, 1, 1, 1); init_light(GL_LIGHT1, 1, 0, 1, 1, 1, 1); init_light(GL_LIGHT2, 1, 1, 0, 1, 1, 1); init_balls(); init_bat(); }
void init_game(t_ole *t) { int i; t->pit = -90; t->vx = xmalloc(sizeof(float) * (NB_BALL)); t->vy = xmalloc(sizeof(float) * (NB_BALL)); t->oball = xmalloc(sizeof(int) * (NB_BALL)); t->ball = xmalloc(sizeof(int) * (NB_BALL)); mlx_put_image_to_window(t->mlx, t->win, t->img, 0, 0); i = 0; t->state = 0; my_draw_disc(t->img, W / 2, H / 2, W / 10 + SPEED_BALL, COLOR_BG, H, W); my_draw_circle(t->img, W / 2, H / 2, W / 10, COLOR_LINE); my_draw_disc(t->img, W / 2, H / 2, W / 12, COLOR_CORE, H, W); draw_the_pit(t); init_balls(t); while (i < NB_BALL) { put_ball(t, i); i = i + 1; } expose(t); }