X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/graphlib.git/blobdiff_plain/abb9adcc79ad7c8bff8741c19df15e6fad1603c6..87054f0da897634ebfc9b5ae02a7899cc81ceaa4:/test/hello.cpp diff --git a/test/hello.cpp b/test/hello.cpp index 4143590..d98d2a6 100644 --- a/test/hello.cpp +++ b/test/hello.cpp @@ -26,7 +26,7 @@ #include -int flip(DrawingWindow &w) +void flip(DrawingWindow &w) { std::cout << "[ " << w.width() << " x " << w.height() << " ]\n"; @@ -50,10 +50,9 @@ int flip(DrawingWindow &w) // << y << " (" << c << ")\n"; } } - return 0; } -int mandel(DrawingWindow &w) +void mandel(DrawingWindow &w) { /* paramètres par défaut */ int larg = w.width(); @@ -116,16 +115,38 @@ int mandel(DrawingWindow &w) } cr += pr; } - return 0; +} + +void lines(DrawingWindow &w) +{ + int n = 100000; + int xmax = w.width(); + int ymax = w.height(); + while (n-- > 0) { + double r = rand() / (float )RAND_MAX; + double g = rand() / (float )RAND_MAX; + double b = rand() / (float )RAND_MAX; + int x1 = rand() % xmax; + int y1 = rand() % ymax; + int x2 = rand() % xmax; + int y2 = rand() % ymax; + w.setColor(r, g, b); + w.drawLine(x1, y1, x2, y2); + } } int main(int argc, char *argv[]) { - const int nf = 1; - const int nm = 1; const int w = 1000; const int h = 700; QApplication application(argc, argv); + + DrawingWindow dd(lines, w, h); + dd.show(); +// return application.exec(); + + const int nf = 1; + const int nm = 1; DrawingWindow *dw[nf + nm]; for (int i = 0; i < nf; ++i)