# Contact <francois.fleuret@epfl.ch> for comments & bug reports #
#============================================================================#
-# CXX=g++-3.3
-
ifeq ($(DEBUG),yes)
CXXFLAGS = -fPIC -Wall -g -DDEBUG
else
# Optimized compilation
-# CXXFLAGS = -Wall -g -O3 -pg --coverage
+ # CXXFLAGS = -Wall -g -O3 -pg --coverage
CXXFLAGS = -fPIC -Wall -g -O3
endif
-LDFLAGS = -L/usr/X11R6/lib/ -lz -ldl
+LDFLAGS = -lz -ldl
+
+# Do we use X11?
+CXXFLAGS += -DX11_SUPPORT
+LDFLAGS += -L/usr/X11R6/lib/
# Do we use cairo?
CXXFLAGS += -I/usr/include/cairo -DCAIRO_SUPPORT
else if(degree == 1) _square_size = 150;
else if(degree == 2) _square_size = 100;
else _square_size = 50;
- scalar_t x[] = { -_square_size/2.0, _square_size/2.0, _square_size/2.0, -_square_size/2.0 };
- scalar_t y[] = { -_square_size/2.0, -_square_size/2.0, _square_size/2.0, _square_size/2.0 };
+ scalar_t x[] = { -_square_size / 2.0, _square_size / 2.0, _square_size / 2.0, -_square_size / 2.0 };
+ scalar_t y[] = { -_square_size / 2.0, -_square_size / 2.0, _square_size / 2.0, _square_size / 2.0 };
_target = new Polygon(0.5, 1.0, 1.0, 0.0, x, y, 4);
_target->set_position(_square_size/2, _square_size/2 + (world_height - _square_size) * drand48(), 0);
_target->set_speed(0, 0, 0);
_nb_vertices, _x, _y);
}
+#ifdef X11_SUPPORT
void Polygon::draw(SimpleWindow *window) {
window->color(_red, _green, _blue);
int x[_nb_vertices], y[_nb_vertices];
window->draw_line(x[n], y[n], x[(n+1)%_nb_vertices], y[(n+1)%_nb_vertices]);
}
}
+#endif
#ifdef CAIRO_SUPPORT
void Polygon::draw(cairo_t* context_resource) {
#define POLYGON_H
#include "misc.h"
-#include "simple_window.h"
#include "xfig_tracer.h"
+#ifdef X11_SUPPORT
+#include "simple_window.h"
+#endif
+
#ifdef CAIRO_SUPPORT
#include <cairo.h>
#endif
void color_xfig(XFigTracer *tracer);
void print_xfig(XFigTracer *tracer);
+#ifdef X11_SUPPORT
void draw(SimpleWindow *window);
void draw_contours(SimpleWindow *window);
+#endif
#ifdef CAIRO_SUPPORT
void draw(cairo_t* context_resource);
}
}
+#ifdef X11_SUPPORT
void Universe::draw(SimpleWindow *window) {
for(int n = 0; n < _nb_polygons; n++) {
if(_polygons[n]) {
}
}
}
+#endif
#ifdef CAIRO_SUPPORT
void Universe::draw(cairo_t *context_resource) {
#include <iostream>
#include <cmath>
+#include "misc.h"
+#include "polygon.h"
+
+#ifdef X11_SUPPORT
+#include "simple_window.h"
+#endif
+
#ifdef CAIRO_SUPPORT
#include <cairo.h>
#endif
using namespace std;
-#include "misc.h"
-#include "simple_window.h"
-#include "polygon.h"
-
class Universe {
scalar_t _xmax, _ymax;
public:
Polygon *pick_polygon(scalar_t x, scalar_t y);
void print_xfig(XFigTracer *tracer);
+
+#ifdef X11_SUPPORT
void draw(SimpleWindow *window);
+#endif
#ifdef CAIRO_SUPPORT
void draw(cairo_t *context_resource);