2 ////////////////////////////////////////////////////////////////////////////////
3 // This program is free software; you can redistribute it and/or //
4 // modify it under the terms of the GNU General Public License //
5 // version 2 as published by the Free Software Foundation. //
7 // This program is distributed in the hope that it will be useful, but //
8 // WITHOUT ANY WARRANTY; without even the implied warranty of //
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
10 // General Public License for more details. //
12 // Written and (C) by François Fleuret //
13 // Contact <francois.fleuret@epfl.ch> for comments & bug reports //
14 ////////////////////////////////////////////////////////////////////////////////
16 // $Id: universe.h,v 1.21 2006-12-17 19:22:19 fleuret Exp $
27 #include "simple_window.h"
31 scalar_t _xmax, _ymax;
33 int _nb_max_polygons, _nb_polygons;
35 Universe(int nb_max_polygons, scalar_t xmax, scalar_t ymax);
36 // The destructor deletes all the added polygons
38 void initialize(Polygon *p);
40 void add_polygon(Polygon *p);
41 bool collide(Polygon *p);
42 // Compute collisions between projections of the polygons on a few
43 // axis to speed up the computation
44 void compute_pseudo_collisions(int nb_axis, int *nb_colliding_axis);
45 void apply_collision_forces(scalar_t dt);
46 bool update(scalar_t dt);
47 Polygon *pick_polygon(scalar_t x, scalar_t y);
48 void print_fig(ostream &os);
49 void draw(SimpleWindow *window);