X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=universe.cc;h=8dec7f5b016dc75bb66422b4e2c575334bcd5382;hb=9284cd8bb4fe83fad551a6b51fc1f8c9c95b6591;hp=4a2e4f9e1189a8d4921c853a316d477a56686e8b;hpb=a014985119307fe97a26f33a98c9c5d7b99f09f2;p=universe.git diff --git a/universe.cc b/universe.cc index 4a2e4f9..8dec7f5 100644 --- a/universe.cc +++ b/universe.cc @@ -163,6 +163,14 @@ void Universe::draw(Canvas *canvas) { } } +void Universe::apply_gravity(scalar_t dt, scalar_t fx, scalar_t fy) { + for(int n = 0; n < _nb_polygons; n++) + if(_polygons[n]) + _polygons[n]->apply_force(dt, + _polygons[n]->_center_x, _polygons[n]->_center_y, + fx, fy); +} + void Universe::apply_collision_forces(scalar_t dt) { const int nb_axis = 2; int nb_collision[_nb_polygons * _nb_polygons];