TASK_SRC = dummy.cc move_square.cc hit_shape.cc
TASK_OBJ = $(TASK_SRC:.cc=.so)
-all: main TAGS $(TASK_OBJ)
+all: main generate TAGS $(TASK_OBJ)
TAGS: *.cc *.h
etags *.cc *.h
intelligence.o
$(CXX) $(CXXFLAGS) $(LDFLAGS) -lX11 -o $@ $^
+generate: generate.o misc.o \
+ universe.o \
+ plotter.o \
+ polygon.o \
+ canvas.o canvas_cairo.o
+ $(CXX) $(CXXFLAGS) $(LDFLAGS) -lX11 -o $@ $^
+
%.so: %.cc misc.o universe.o polygon.o xfig_tracer.o map.o task.o manipulator.o
$(CXX) $(CXXFLAGS) -shared -Wl,-soname,$@ -o $@ $^
--- /dev/null
+
+////////////////////////////////////////////////////////////////////
+// START_IP_HEADER //
+// //
+// Written by Francois Fleuret //
+// Contact <francois.fleuret@idiap.ch> for comments & bug reports //
+// //
+// END_IP_HEADER //
+////////////////////////////////////////////////////////////////////
+
+#include <iostream>
+#include <fstream>
+#include <cmath>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <errno.h>
+#include <string.h>
+
+using namespace std;
+
+#include "misc.h"
+#include "task.h"
+#include "simple_window.h"
+#include "universe.h"
+#include "plotter.h"
+#include "retina.h"
+#include "manipulator.h"
+#include "intelligence.h"
+#include "canvas_cairo.h"
+
+void generate_png(Universe *universe, scalar_t scale, FILE *file) {
+ CanvasCairo canvas(scale, universe->width(), universe->height());
+ universe->draw(&canvas);
+ canvas.write_png(file);
+}
+
+int main(int argc, char **argv) {
+
+}
plotter.save_as_ppm(&universe, "/tmp/plotter.ppm", 16);
}
+#ifdef XFIG_SUPPORT
{
XFigTracer tracer("/tmp/universe.fig");
universe.print_xfig(&tracer);
}
+#endif
#ifdef CAIRO_SUPPORT
{
return new Polygon(_mass, _red, _green, _blue, _relative_x, _relative_y, _nb_vertices);
}
+#ifdef XFIG_SUPPORT
void Polygon::color_xfig(XFigTracer *tracer) {
tracer->add_color(int(255 * _red), int(255 * _green), int(255 * _blue));
}
tracer->draw_polygon(int(255 * _red), int(255 * _green), int(255 * _blue),
_nb_vertices, _x, _y);
}
+#endif
#ifdef X11_SUPPORT
void Polygon::draw(SimpleWindow *window) {
#include "misc.h"
#include "canvas.h"
+#ifdef XFIG_SUPPORT
#include "xfig_tracer.h"
+#endif
#ifdef X11_SUPPORT
#include "simple_window.h"
Polygon *clone();
+#ifdef XFIG_SUPPORT
void color_xfig(XFigTracer *tracer);
void print_xfig(XFigTracer *tracer);
+#endif
#ifdef X11_SUPPORT
void draw(SimpleWindow *window);
return 0;
}
+#ifdef XFIG_SUPPORT
void Universe::print_xfig(XFigTracer *tracer) {
for(int n = 0; n < _nb_polygons; n++) {
if(_polygons[n]) {
}
}
}
+#endif
#ifdef X11_SUPPORT
void Universe::draw(SimpleWindow *window) {
Polygon *pick_polygon(scalar_t x, scalar_t y);
+#ifdef XFIG_SUPPORT
void print_xfig(XFigTracer *tracer);
+#endif
#ifdef X11_SUPPORT
void draw(SimpleWindow *window);