Cairo support works, both to draw in the window and to write as a png image in a...
[universe.git] / universe.h
index 4ea8f2e..3bbbf4a 100644 (file)
@@ -1,17 +1,6 @@
 
 
-////////////////////////////////////////////////////////////////////////////////
-// This program is free software; you can redistribute it and/or              //
-// modify it under the terms of the GNU General Public License                //
-// version 2 as published by the Free Software Foundation.                    //
-//                                                                            //
-// This program is distributed in the hope that it will be useful, but        //
-// WITHOUT ANY WARRANTY; without even the implied warranty of                 //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU          //
-// General Public License for more details.                                   //
-//                                                                            //
-// Written and (C) by François Fleuret                                        //
-// Contact <francois.fleuret@epfl.ch> for comments & bug reports              //
-////////////////////////////////////////////////////////////////////////////////
+// Written and (C) by Francois Fleuret
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports
 
 #ifndef UNIVERSE_H
 #define UNIVERSE_H
 
 #ifndef UNIVERSE_H
 #define UNIVERSE_H
@@ -19,6 +8,10 @@
 #include <iostream>
 #include <cmath>
 
 #include <iostream>
 #include <cmath>
 
+#ifdef CAIRO_SUPPORT
+#include <cairo.h>
+#endif
+
 using namespace std;
 
 #include "misc.h"
 using namespace std;
 
 #include "misc.h"
@@ -30,21 +23,30 @@ class Universe {
 public:
   int _nb_max_polygons, _nb_polygons;
   Polygon **_polygons;
 public:
   int _nb_max_polygons, _nb_polygons;
   Polygon **_polygons;
+
   Universe(int nb_max_polygons, scalar_t xmax, scalar_t ymax);
   // The destructor deletes all the added polygons
   ~Universe();
   Universe(int nb_max_polygons, scalar_t xmax, scalar_t ymax);
   // The destructor deletes all the added polygons
   ~Universe();
+
   void initialize(Polygon *p);
   void clear();
   void add_polygon(Polygon *p);
   bool collide(Polygon *p);
   void initialize(Polygon *p);
   void clear();
   void add_polygon(Polygon *p);
   bool collide(Polygon *p);
+
   // Compute collisions between projections of the polygons on a few
   // axis to speed up the computation
   void compute_pseudo_collisions(int nb_axis, int *nb_colliding_axis);
   void apply_collision_forces(scalar_t dt);
   bool update(scalar_t dt);
   // Compute collisions between projections of the polygons on a few
   // axis to speed up the computation
   void compute_pseudo_collisions(int nb_axis, int *nb_colliding_axis);
   void apply_collision_forces(scalar_t dt);
   bool update(scalar_t dt);
+
   Polygon *pick_polygon(scalar_t x, scalar_t y);
   Polygon *pick_polygon(scalar_t x, scalar_t y);
-  void print_fig(ostream &os);
+
+  void print_xfig(XFigTracer *tracer);
   void draw(SimpleWindow *window);
   void draw(SimpleWindow *window);
+
+#ifdef CAIRO_SUPPORT
+  void draw(cairo_t *context_resource);
+#endif
 };
 
 #endif
 };
 
 #endif