#include "universe.h"
#include "canvas_cairo.h"
-FILE *safe_fopen(const char *name, const char *mode) {
- FILE *file = fopen(name, mode);
- if(!file) {
- cerr << "Cannot open " << name << endl;
- exit(1);
- }
- return file;
-}
-
-void print_help(const char *command) {
- cerr << command << " <nb sequences to generate> [--dir <dir>] [--seed <seed>]]" << endl;
- exit(1);
-}
-
//////////////////////////////////////////////////////////////////////
void draw_universe_on_canvas(CanvasCairo *canvas, scalar_t scaling,
int random_grasp = 1;
int random_shape_size = 0;
int nb_shapes = 10;
- // char data_dir[1024] = "/tmp/";
- // int show_grabbing_point = 0;
int skip = -1;
for(int n = 0; n < nb_sequences; n++) {
scalar_t xf = grabbed_polygon->absolute_x(grab_relative_x, grab_relative_y);
scalar_t yf = grabbed_polygon->absolute_y(grab_relative_x, grab_relative_y);
grabbed_polygon->apply_force(dt, xf, yf, 0.0, -1.0);
- universe->update(dt);
+ universe->update(dt, 1.0 / scaling);
}
}
}
}
}
}
-
- /*
- {
- cout << canvases[0]->_actual_width << " "<< canvases[1]->_actual_height << endl;
- cout << "Writing /tmp/sanity.png" << endl;
- CanvasCairo main_canvas(scaling, nb_images_per_sequence, 1, canvases);
- FILE *file = safe_fopen("/tmp/sanity.png", "w");
- main_canvas.write_png(file);
- fclose(file);
- }
- */
}
for(int t = 0; t < 2 * nb_saved_frames; t++) {