-
-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
switches to specify vertical and horizontal char densities #129
base: master
Are you sure you want to change the base?
Changes from all commits
77eddf2
1d131c3
adfdf16
9388814
9c0e48e
d8bbd79
ed994f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,8 @@ int xwindow = 0; | |
int lock = 0; | ||
cmatrix **matrix = (cmatrix **) NULL; | ||
int *length = NULL; /* Length of cols in each line */ | ||
int space = 50; /* vertical density parameter */ | ||
int skip = 2; /* horizontal density parameter */ | ||
int *spaces = NULL; /* Spaces left to fill */ | ||
int *updates = NULL; /* What does this do again? */ | ||
#ifndef _WIN32 | ||
|
@@ -153,6 +155,8 @@ void usage(void) { | |
printf(" -h: Print usage and exit\n"); | ||
printf(" -n: No bold characters (overrides -b and -B, default)\n"); | ||
printf(" -s: \"Screensaver\" mode, exits on first keystroke\n"); | ||
printf(" -S <int> vertical character density; default 50\n"); | ||
printf(" -T <int> horizontal character density; default 2\n"); | ||
printf(" -x: X window mode, use if your xterm is using mtx.pcf\n"); | ||
printf(" -V: Print version information and exit\n"); | ||
printf(" -M [message]: Prints your message in the center of the screen. Overrides -L's default message.\n"); | ||
|
@@ -162,6 +166,27 @@ void usage(void) { | |
printf(" -m: lambda mode\n"); | ||
printf(" -k: Characters change while scrolling. (Works without -o opt.)\n"); | ||
printf(" -t [tty]: Set tty to use\n"); | ||
|
||
printf("\n\n Runtime keys:\n"); | ||
printf(" q: quit\n"); | ||
printf(" a: Asynchronous scroll\n"); | ||
printf(" b: Bold characters on\n"); | ||
printf(" B: All bold characters (overrides -b)\n"); | ||
printf(" n: No bold characters (overrides -b and -B, default)\n"); | ||
printf(" 0-9: Screen update delay\n"); | ||
printf(" !: red\n"); | ||
printf(" @: green\n"); | ||
printf(" #: yellow\n"); | ||
printf(" $: blue\n"); | ||
printf(" %%: magenta\n"); | ||
printf(" ^: cyan\n"); | ||
printf(" &: white\n"); | ||
printf(" m: increase vertical density by 10\n"); | ||
printf(" l: decrease vertical density by 10\n"); | ||
|
||
printf("\n\n Examples:\n"); | ||
printf(" In console try: cmatrix -lab -S 120 -T 1\n"); | ||
printf(" In X try: xterm -bg black -fn mtx -e cmatrix -xab\n"); | ||
} | ||
|
||
void version(void) { | ||
|
@@ -215,14 +240,14 @@ void var_init() { | |
|
||
/* Make the matrix */ | ||
for (i = 0; i <= LINES; i++) { | ||
for (j = 0; j <= COLS - 1; j += 2) { | ||
for (j = 0; j <= COLS - 1; j += skip) { | ||
matrix[i][j].val = -1; | ||
} | ||
} | ||
|
||
for (j = 0; j <= COLS - 1; j += 2) { | ||
for (j = 0; j <= COLS - 1; j += skip) { | ||
/* Set up spaces[] array of how many spaces to skip */ | ||
spaces[j] = (int) rand() % LINES + 1; | ||
spaces[j] = (int) rand() % space; | ||
|
||
/* And length of the stream */ | ||
length[j] = (int) rand() % (LINES - 3) + 3; | ||
|
@@ -333,7 +358,7 @@ int main(int argc, char *argv[]) { | |
|
||
/* Many thanks to morph- ([email protected]) for this getopt patch */ | ||
opterr = 0; | ||
while ((optchr = getopt(argc, argv, "abBcfhlLnrosmxkVM:u:C:t:")) != EOF) { | ||
while ((optchr = getopt(argc, argv, "abBcfhlLnrosmxkVM:S:T:u:C:t:")) != EOF) { | ||
switch (optchr) { | ||
case 's': | ||
screensaver = 1; | ||
|
@@ -407,6 +432,14 @@ int main(int argc, char *argv[]) { | |
case 'x': | ||
xwindow = 1; | ||
break; | ||
case 'S': | ||
space = atoi(optarg); | ||
if (space <= 0) | ||
space = 1; | ||
break; | ||
case 'T': | ||
skip = atoi(optarg); | ||
break; | ||
case 'V': | ||
version(); | ||
exit(0); | ||
|
@@ -525,7 +558,7 @@ if (console) { | |
highnum = 217; | ||
} else { | ||
randmin = 33; | ||
highnum = 123; | ||
highnum = 123; /* shouldn't this be 33 + 93 = 126 ?*/ | ||
} | ||
randnum = highnum - randmin; | ||
|
||
|
@@ -606,6 +639,16 @@ if (console) { | |
case '9': | ||
update = keypress - 48; | ||
break; | ||
case 'm': | ||
space += 10; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The indentation seems off in some places like this line for example. Can you please fix this |
||
if (space <= 0) | ||
space = 1; | ||
break; | ||
case 'l': | ||
space -= 10; | ||
if (space <= 0) | ||
space = 1; | ||
break; | ||
case '!': | ||
mcolor = COLOR_RED; | ||
rainbow = 0; | ||
|
@@ -629,7 +672,7 @@ if (console) { | |
case 'r': | ||
rainbow = 1; | ||
break; | ||
case 'm': | ||
case 'M': | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of modifying an existing option, can we switch the new option to use another letter or capital M if no other letters seem fit for the cause? |
||
lambda = !lambda; | ||
break; | ||
case '^': | ||
|
@@ -648,7 +691,7 @@ if (console) { | |
} | ||
} | ||
} | ||
for (j = 0; j <= COLS - 1; j += 2) { | ||
for (j = 0; j <= COLS - 1; j += skip) { | ||
if ((count > updates[j] || asynch == 0) && pause == 0) { | ||
|
||
/* I don't like old-style scrolling, yuck */ | ||
|
@@ -692,7 +735,7 @@ if (console) { | |
length[j] = (int) rand() % (LINES - 3) + 3; | ||
matrix[0][j].val = (int) rand() % randnum + randmin; | ||
|
||
spaces[j] = (int) rand() % LINES + 1; | ||
spaces[j] = (int) rand() % space; | ||
} | ||
i = 0; | ||
y = 0; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make them constants? (I am not sure if we modify them later, can you check?)