mirror of
https://github.com/PoetryInCode/matrix.git
synced 2026-08-13 11:24:40 -04:00
Added proper flag handling, still need to optimize rest of code
This commit is contained in:
parent
4d073347f3
commit
94dd792430
BIN
bin/matrix
BIN
bin/matrix
Binary file not shown.
43
src/main.c
43
src/main.c
@ -17,6 +17,13 @@
|
|||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int help() {
|
||||||
|
puts("Program Flags:");
|
||||||
|
printf("\t--tickTime [integer]\n\t\tWill change the time waited between frame updates in miliseconds\n\n");
|
||||||
|
printf("\t--streanLen [integer]\n\t\tChanges the vertical length of the stream in characters\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
WINDOW term = *initscr();
|
WINDOW term = *initscr();
|
||||||
@ -25,20 +32,32 @@ int main(int argc, char **argv) {
|
|||||||
attron(COLOR_PAIR(1));
|
attron(COLOR_PAIR(1));
|
||||||
noecho();
|
noecho();
|
||||||
if(nodelay(&term,TRUE)==ERR) {
|
if(nodelay(&term,TRUE)==ERR) {
|
||||||
puts("Error could not enter no-delay mode");
|
puts("[ERROR] could not enter no-delay mode");
|
||||||
return ERR;
|
return ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int time;
|
int time = 15;
|
||||||
int initTailLen;
|
int initTailLen = 20;
|
||||||
for(int i=1; i<argc; i++) {
|
for(int i=1; i<argc; i++) {
|
||||||
if(strcmp(argv[i],"--tickTime")) {
|
if(strcmp(argv[i],"--help") == 0 || strcmp(argv[i], "-h") == 0) {
|
||||||
time=atoi(argv[i+1]);
|
endwin();
|
||||||
i++;
|
help();
|
||||||
}
|
return 1;
|
||||||
if(strcmp(argv[i],"--streamLen")) {
|
} else {
|
||||||
initTailLen=atoi(argv[i+1]);
|
if(strcmp(argv[i],"--tickTime") == 0) {
|
||||||
i++;
|
time=atoi(argv[i+1]);
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
if(strcmp(argv[i],"--streamLen") == 0) {
|
||||||
|
initTailLen=atoi(argv[i+1]);
|
||||||
|
i++;
|
||||||
|
} else {
|
||||||
|
endwin();
|
||||||
|
printf("[ERROR] Invalid flag\n\n");
|
||||||
|
help();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
timeout(time);
|
timeout(time);
|
||||||
@ -116,7 +135,7 @@ int main(int argc, char **argv) {
|
|||||||
tail[i]--;
|
tail[i]--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(jmpTail[i]==maxY || jmpTail==0) {
|
if(jmpTail[i]==maxY || jmpTail[i]==0) {
|
||||||
jmpTail[i]=OK;
|
jmpTail[i]=OK;
|
||||||
} else {
|
} else {
|
||||||
if(dir==DOWN) {
|
if(dir==DOWN) {
|
||||||
@ -162,5 +181,5 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
endwin();
|
endwin();
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
vgcore.665139
Normal file
BIN
vgcore.665139
Normal file
Binary file not shown.
BIN
vgcore.739267
Normal file
BIN
vgcore.739267
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user