static bool main_loop (void) { unsigned int app_state = 0; unsigned long int counter = 0; double s, t; initial_condition(n, px, py, vx, vy, m); s = 0.0; NBODY_OMP_PARALLEL do { NBODY_OMP_MASTER { t = timer(); } physics_advance(dt, n, px, py, vx, vy, m); NBODY_OMP_MASTER { t = timer() - t; s += t; if (draw_redraw()) { draw_particles(dt, n, px, py, vx, vy, m); app_state = draw_input(app_state, &dt); } counter += 1; if ((counter % 1000LU) == 0) printf("%lu\n", counter); } NBODY_OMP_BARRIER ; } while (! (app_state & EXIT) && ! (app_state & RESET)); printf("%lu physics iterations over %f seconds, ratio %f\n", counter, s, counter/s); return app_state & RESET; }
void draw_reshape(int w, int h){ win_w = w; win_h = h; draw_redraw(); }
void camera_set_position(vec_t pos){ cam_pos = pos; draw_redraw(); }