/********************************************************************** DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. **********************************************************************/ #include #include #include #include #include #include #include #include #include "ecran.h" int verbosity; /* ---------------------------------------------------------------- */ int demo_minidigits(int nbl, int k) { int loop, foo; char chaine[100]; for (loop=0; loop 1023.0) { rvals[foo] = (float)(rand() % 25); } } plot_waterfall(water, 1, rvals); /* if (rand()%10 < 1) sleep(1); */ foo = nanosleep(&ts, NULL); if (foo) { /* got a signal ? */ aff_message("err on nanosleep"); } } close_waterfall(water, 0); } /* ---------------------------------------------------------------- */ static void finish(int signal) { endwin(); exit(0); } /* ---------------------------------------------------------------- */ int main (int argc, char *argv[]) { int opt; int demonum = 0; int nb_loops = 200; /* set some default values */ verbosity = 0; while ((opt = getopt(argc, argv, "n:vy:")) != -1) { switch (opt) { case 'n': nb_loops = atoi(optarg); break; case 'v': verbosity++; break; case 'y': demonum = atoi(optarg); break; default: fprintf(stderr, "%s : uh ?", argv[0]); exit(1); break; } } initscr(); nonl(); cbreak(); noecho(); keypad(stdscr, TRUE); /* acces aux touches 'curseur' */ fond_ecran(" Ncurses Eyecandy "); switch (demonum) { case 0: demo_vumetres(nb_loops, 0); break; case 1: demo_waterfall(nb_loops, 0); break; case 2: demo_7segments(nb_loops, 0); break; case 3: demo_composite(nb_loops, 0); break; case 4: demo_minidigits(nb_loops, 0); break; default: fprintf(stderr, "eyecandy #%d don't exist\n", demonum); break; } /* * plop, on a fini, restaurer la console */ finish(0); return 0; } /* ---------------------------------------------------------------- */