Update.
[flatland.git] / universe.cc
index 32e6f33..ad3ebf7 100644 (file)
@@ -159,6 +159,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];