diff --git a/Makefile b/Makefile index 5c82534..b75635f 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,16 @@ all: build -CC=clang -STD=gnu99 -OPT=-Os -DBG=-g -ggdb -OTHER= - -CMD=$(CC) $(DBG) -std=$(STD) $(OPT) $(OPT) -LINK=-lncurses - -FINBIN=bin/matrix +CFLAGS=-lncurses install: build ; cp -u $(FINBIN) /usr/local/bin/ -build: - $(CMD) ./src/main.c $(LINK) -o ./bin/matrix +build: ./matrix -valgrind: build ; - valgrind ./$(FINBIN) +./matrix: ./matrix.c clean: - rm -rf ./bin/* - -clean-logs: - rm ./vgcore.* - rm ./massif.out.* + rm -f ./matrix run: bin/matrix ; - ./bin/matrix --tickTime 15 --streamLen 20 \ No newline at end of file + ./bin/matrix --tickTime 15 --streamLen 20 diff --git a/README.md b/README.md index 324b32c..bbdfeeb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Matrix -A matrix program to get some practice with C and the [ncurses](https://github.com/mirror/ncurses) library +A matrix program to get some practice with C and the [ncurses](https://github.com/mirror/ncurses) library. + +This project just recently turned 4 years old, and was one of my first C projects! +I have been using it as a screen saver for my office all this time. + +After staring at it running on this old CRT monitor in my office off of a Mac trash can (aka. 2013 Mac Pro) +that is running Void Linux. I decided that it could do with a makeover. # Features diff --git a/bin/matrix b/bin/matrix deleted file mode 100755 index 4ecdbcf..0000000 Binary files a/bin/matrix and /dev/null differ diff --git a/matrix b/matrix new file mode 100755 index 0000000..88d117b Binary files /dev/null and b/matrix differ diff --git a/matrix.c b/matrix.c new file mode 100644 index 0000000..93a9899 --- /dev/null +++ b/matrix.c @@ -0,0 +1,188 @@ +#include +#include +#include +#include +#include +#include +#include + +#define UP (1) +#define DOWN (2) + +#ifndef TRUE + #define TRUE 1 +#endif + +#ifndef FALSE + #define FALSE 0 +#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 time = 15; + int initTailLen = 20; + for(int i=1; i1) { + tailLen[i]=initTailLen+(rand()%(4%initTailLen)); + } else { + if(num<=1) { + tailLen[i]=initTailLen-(rand()%initTailLen); + } + } + } + int cascade[maxX]; + int tail[maxX]; + int jmpTail[maxX]; + + for(int i=0; i -#include -#include -#include -#include -#include -#include - -#define UP (1) -#define DOWN (2) - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#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 time = 15; - int initTailLen = 20; - for(int i=1; i1) { - tailLen[i]=initTailLen+(rand()%(4%initTailLen)); - } else { - if(num<=1) { - tailLen[i]=initTailLen-(rand()%initTailLen); - } - } - } - int cascade[maxX]; - int tail[maxX]; - int jmpTail[maxX]; - - for(int i=0; i