amatrix

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
git clone git://git.kocotian.pl/amatrix.git
Log | Files | Refs | README | LICENSE

commit c15d24a656d3ca4087c95253267807f41e26b686
parent cdd37293fb2d2b61b22e7d6b0fdab27e48d3146d
Author: Yi Cao <32544798+xiaoyu2006@users.noreply.github.com>
Date:   Mon, 18 Nov 2019 11:59:16 +0800

So I opened this PR again... (#92)

* Chrs changes with opt "-k".

* Correct Usage message.

* For a clean code...

Diffstat:
Mcmatrix.c | 13+++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/cmatrix.c b/cmatrix.c @@ -127,7 +127,7 @@ void c_die(char *msg, ...) { } void usage(void) { - printf(" Usage: cmatrix -[abBcfhlsmVx] [-u delay] [-C color]\n"); + printf(" Usage: cmatrix -[abBcfhlsmVxk] [-u delay] [-C color]\n"); printf(" -a: Asynchronous scroll\n"); printf(" -b: Bold characters on\n"); printf(" -B: All bold characters (overrides -b)\n"); @@ -145,6 +145,7 @@ void usage(void) { printf(" -C [color]: Use this color for matrix (default green)\n"); printf(" -r: rainbow mode\n"); printf(" -m: lambda mode\n"); + printf(" -k: Characters change while scorlling. (Works without -o opt.)\n"); } void version(void) { @@ -287,13 +288,14 @@ int main(int argc, char *argv[]) { int randmin = 0; int pause = 0; int classic = 0; + int changes = 0; srand((unsigned) time(NULL)); setlocale(LC_ALL, ""); /* Many thanks to morph- (morph@jmss.com) for this getopt patch */ opterr = 0; - while ((optchr = getopt(argc, argv, "abBcfhlLnrosmxVu:C:")) != EOF) { + while ((optchr = getopt(argc, argv, "abBcfhlLnrosmxkVu:C:")) != EOF) { switch (optchr) { case 's': screensaver = 1; @@ -369,6 +371,9 @@ int main(int argc, char *argv[]) { case 'm': lambda = 1; break; + case 'k': + changes = 1; + break; } } @@ -630,6 +635,10 @@ if (console) { while (i <= LINES && (matrix[i][j].val != ' ' && matrix[i][j].val != -1)) { matrix[i][j].is_head = false; + if(changes) { + if(rand() % 8 == 0) + matrix[i][j].val = (int) rand() % randnum + randmin; + } i++; y++; }