Cosmetics + started to add support for cairo drawing to eventually replace the X...
[universe.git] / universe.cc
index 48d8efc..9522dfd 100644 (file)
@@ -130,9 +130,34 @@ void Universe::print_xfig(XFigTracer *tracer) {
 }
 
 void Universe::draw(SimpleWindow *window) {
-  for(int n = 0; n < _nb_polygons; n++) if(_polygons[n]) _polygons[n]->draw(window);
-  for(int n = 0; n < _nb_polygons; n++) if(_polygons[n]) _polygons[n]->draw_contours(window);
+  for(int n = 0; n < _nb_polygons; n++) {
+    if(_polygons[n]) {
+      _polygons[n]->draw(window);
+    }
+  }
+
+  for(int n = 0; n < _nb_polygons; n++) {
+    if(_polygons[n]) {
+      _polygons[n]->draw_contours(window);
+    }
+  }
+}
+
+#ifdef CAIRO_SUPPORT
+void Universe::draw(cairo_t *context_resource) {
+  for(int n = 0; n < _nb_polygons; n++) {
+    if(_polygons[n]) {
+      _polygons[n]->draw(context_resource);
+    }
+  }
+
+  for(int n = 0; n < _nb_polygons; n++) {
+    if(_polygons[n]) {
+      _polygons[n]->draw_contours(context_resource);
+    }
+  }
 }
+#endif
 
 void Universe::apply_collision_forces(scalar_t dt) {
   const int nb_axis = 2;