Update.
[universe.git] / universe.cc
index 4a2e4f9..6eca067 100644 (file)
@@ -149,6 +149,7 @@ void Universe::draw(SimpleWindow *window) {
 }
 #endif
 
+#ifdef CAIRO_SUPPORT
 void Universe::draw(Canvas *canvas) {
   for(int n = 0; n < _nb_polygons; n++) {
     if(_polygons[n]) {
@@ -162,6 +163,15 @@ void Universe::draw(Canvas *canvas) {
     }
   }
 }
+#endif
+
+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;