Converted spaces to tabs, and changed to setting a delay instead of a speed up amount

This commit is contained in:
Tyler Cromwell 2015-01-11 10:10:04 -05:00 committed by K Lange
parent b81aac9d23
commit 9a920e8c5b
2 changed files with 14 additions and 12 deletions

View File

@ -30,8 +30,10 @@ Do not set the titlebar text.
.B \-e, \-\-no\-clear .B \-e, \-\-no\-clear
Do not clear the display between frames. Do not clear the display between frames.
.TP .TP
.B \-u, \-\-usleep .B \-d, \-\-delay
Set how frequently the image refreshes (1 <= t <= 10). Delay image rendering by anywhere between 10ms and 1000ms.
.br
Default (90ms) is used if amount is out of range.
.TP .TP
.B \-f, \-\-frames .B \-f, \-\-frames
Display the requested number of frames, then quit. Display the requested number of frames, then quit.

View File

@ -335,7 +335,7 @@ void usage(char * argv[]) {
" -n --no-counter \033[3mDo not display the timer\033[0m\n" " -n --no-counter \033[3mDo not display the timer\033[0m\n"
" -s --no-title \033[3mDo not set the titlebar text\033[0m\n" " -s --no-title \033[3mDo not set the titlebar text\033[0m\n"
" -e --no-clear \033[3mDo not clear the display between frames\033[0m\n" " -e --no-clear \033[3mDo not clear the display between frames\033[0m\n"
" -u --usleep \033[3mSet how frequently the image refreshes (1 <= t <= 10)\033[0m\n" " -d --delay \033[3mDelay image rendering by anywhere between 10ms and 1000ms\n"
" -f --frames \033[3mDisplay the requested number of frames, then quit\033[0m\n" " -f --frames \033[3mDisplay the requested number of frames, then quit\033[0m\n"
" -r --min-rows \033[3mCrop the animation from the top\033[0m\n" " -r --min-rows \033[3mCrop the animation from the top\033[0m\n"
" -R --max-rows \033[3mCrop the animation from the bottom\033[0m\n" " -R --max-rows \033[3mCrop the animation from the bottom\033[0m\n"
@ -370,7 +370,7 @@ int main(int argc, char ** argv) {
{"no-counter", no_argument, 0, 'n'}, {"no-counter", no_argument, 0, 'n'},
{"no-title", no_argument, 0, 's'}, {"no-title", no_argument, 0, 's'},
{"no-clear", no_argument, 0, 'e'}, {"no-clear", no_argument, 0, 'e'},
{"usleep", required_argument, 0, 'u'}, {"delay", required_argument, 0, 'd'},
{"frames", required_argument, 0, 'f'}, {"frames", required_argument, 0, 'f'},
{"min-rows", required_argument, 0, 'r'}, {"min-rows", required_argument, 0, 'r'},
{"max-rows", required_argument, 0, 'R'}, {"max-rows", required_argument, 0, 'R'},
@ -381,12 +381,12 @@ int main(int argc, char ** argv) {
{0,0,0,0} {0,0,0,0}
}; };
/* Determine the usleep time */ /* Time delay in milliseconds */
useconds_t speed_divisor = 1; int delay_ms = 90; // Default to original value
/* Process arguments */ /* Process arguments */
int index, c; int index, c;
while ((c = getopt_long(argc, argv, "eshiItnu:f:r:R:c:C:W:H:", long_opts, &index)) != -1) { while ((c = getopt_long(argc, argv, "eshiItnd:f:r:R:c:C:W:H:", long_opts, &index)) != -1) {
if (!c) { if (!c) {
if (long_opts[index].flag == 0) { if (long_opts[index].flag == 0) {
c = long_opts[index].val; c = long_opts[index].val;
@ -415,10 +415,10 @@ int main(int argc, char ** argv) {
case 'n': case 'n':
show_counter = 0; show_counter = 0;
break; break;
case 'u': case 'd':
if (1 <= atoi(optarg) && atoi(optarg) <= 10) if (10 <= atoi(optarg) && atoi(optarg) <= 1000)
speed_divisor = atoi(optarg); delay_ms = atoi(optarg);
break; break;
case 'f': case 'f':
frame_count = atoi(optarg); frame_count = atoi(optarg);
break; break;
@ -916,7 +916,7 @@ int main(int argc, char ** argv) {
i = 0; i = 0;
} }
/* Wait */ /* Wait */
usleep(90000 / speed_divisor); usleep(1000 * delay_ms);
} }
return 0; return 0;
} }