From 202083fcef50a9f1a2f861b726d81aab37c3bbc0 Mon Sep 17 00:00:00 2001 From: Kied Llaentenn <32681240+Kiedtl@users.noreply.github.com> Date: Thu, 12 Dec 2019 17:08:35 -0500 Subject: [PATCH] update --- cols.h | 7 ++++ fire | Bin 0 -> 21496 bytes main.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ main.o | Bin 0 -> 6576 bytes makefile | 2 +- 5 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 cols.h create mode 100755 fire create mode 100644 main.o diff --git a/cols.h b/cols.h new file mode 100644 index 0000000..8956f00 --- /dev/null +++ b/cols.h @@ -0,0 +1,7 @@ +#ifndef COLS_H +#define COLS_H + +static int colors[] = { + + +#endif diff --git a/fire b/fire new file mode 100755 index 0000000000000000000000000000000000000000..4109ecb1f3069b62e6efe2c2de93a23b66251c11 GIT binary patch literal 21496 zcmeHPe{dYteSf=qdp_w-r;{bwGO}Uq$Y6qXI@xltv5h6!1}x+s*dhtone*xHBwaY^ zl>1@JsTnxgOq>Ms!z4q~nn)z+lmw>nBB;750+>LdDJ`Vx z=kxZhycYf=ZU2nk+}rp4{l4$}zPtN&_jd2v+}LCP+;{)Q6UVpUjgpa2H>pZgKXPJ>y&^g1S|Oh{ZfYQbPWJTg~$cI z1z6Qr0kYDsY5fRbRd)a!L3Q{#V4roN{t!4T`Sf9DIiGNBv!!j?C6B)C0RKZEPF3zn zK4os9{w0d+A9UClJ_tdl!n7PJby-`|sos`!qIs~8OE<@|g9ClxTqfKK&c%hkIAtz? zD;xx^g}QbIeya;#0@&@O1^l3kPyCn*r~R+Zz#pA~|K$w)@fr9D7hVJSNf%E0wWyIs zn>bel#R7m$(|DDPeGoK``!ZCYM`*-f|K)FkKRWtO(1{~RvT$DJpjM++q54oOQCXNW~$(~qmI%)GR&56cGVl)#=r#=rsmxX9wHa3`q@xBb`j<%Z` zkEPR@xab?sriSu;B9)2f(_%QYUu0uL36aagn=If|E-C0a(v8Dl63s{BQSF3kpH=NC z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DkY&L5yq>;!hkS;5%S$hTOYdLY#MX;K= +#include +#include +#include +#include +#include + +#define BOOL unsigned char +#define TRUE 1 +#define FALSE 0 +#define PRINT(...) fprintf(stderr, __VA_ARGS__); + +// I miss the Rust type system :( +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; + +#if UINTPTR_MAX == 0xffff +typedef uint16_t usize; +#elif UINTPTR_MAX == 0xffffffff +typedef uint32_t usize; +#elif UINTPTR_MAX == 0xffffffffffffffff +typedef uint64_t usize; +#endif + + +char esc = (char) 27; +usize width; +usize height; +usize palette[] = { 0x00, 0xff0000, 0xff6611, 0xffff66, 0xffffff }; +usize *pixels; + +void dofire ( void ); +void draw ( void ); + +int +main ( void ) +{ + // populate width and height + struct winsize w; + ioctl(0, TIOCGWINSZ, &w); + + width = w.ws_row; + height = w.ws_col; + + pixels = (usize*) calloc((width * height), sizeof(usize)); + + // init pixels + for (usize i = 0; i < width; i++) + { + pixels[((width * height) - width) + i] = palette[4]; + } + + dofire(); + return 0; +} + +void +dofire ( void ) +{ + for (usize x = 0; x < width; x++) + { + for (usize y = 0; y < height; y++) + { + usize src = y * width + x; + usize random = (rand() % 7) & 3; + usize dest = src - random + 1; + usize color; + + if (width > dest ) dest = 0; + else dest -= width; + + pixels[dest] = pixels[src] - (random & 1); + draw(); + } + } +} + +void +draw ( void ) +{ + // clear screen + PRINT("%c[2J", esc); + + // draw pixels onto screen + for (usize x = 0; x < width; x++) + { + for (usize y = 0; y < height; y++) + { + usize color = pixels[y * width + x]; + u8 blue = color % 256; + u8 green = ((color - blue) / 256) % 256; + u8 red = ((color - blue) / (int)pow((double)256, (double)2))-(green / 256); + + PRINT("%c[48;2;%i;%i;%im %c[0m", esc, red, blue, green, esc); + } + PRINT("\n"); + } +} diff --git a/main.o b/main.o new file mode 100644 index 0000000000000000000000000000000000000000..aad9097dc70fd2c13b35bcba4525b6fca49d6b97 GIT binary patch literal 6576 zcmb7IeQaCR6+iDizZW-lQs=8lYqxbu0s&g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rYwI zx&mbRRi^8SUSY(%Ut0VdOk+LoGPWUpw0j!NlY^0S%E&b;H=0*!8TY?Zrg7KcKT+Wm zffh01VkK%9`doK1E-EV-;SVV%88IWJB$p6vX9RJO5u1OAv5Y9r2;-xS6-37w;pAyX ztnVCSCD9lo;(U&=is)yIEr^Q|MgD6>90yzvGS)N6=q36KBNq9Q#s8AA79IP^dc5DV z4}WK}=%tKzA_o@D?-CiowOaHJ#yf~Q7?G?f<9wnKOP*p}O!PgAeufeD#x42^Bka9q z(Qh*%+3ztH68)7?A-ct=;yaqL1~rac%1g07jMbe7K6w*v?LI`|TW#MxuxDVQf-@2t@R*;oi=0S65s=Y#K=FBS{K$5BB%#_%#0J z$Fi^KTgT`?x3j-EV!Pi+D||vFL!F>!l|i?$^bq zxA|8CTz?0 zt~k-n^Oto|u55281?1)gL)4u~l5LuO=Gwc6=b!c19_w&tduyP`x^^sn%N|&w+4df@ z^cpRGGxYq{n1O9@PgrQD@)78*Wr5XfJ$^QF*mNEV;`7CBwk!>XJ!aX1c<%OdLab)X zehfM{-YbZA5<-p_k9;;>KJ)B37}86aluO&=c1zEW<1+N{ipVzBS>@2e0!# D=YB|` literal 0 HcmV?d00001 diff --git a/makefile b/makefile index 41e681f..b1fe981 100644 --- a/makefile +++ b/makefile @@ -9,7 +9,7 @@ WARNING = -Wall -Wextra -pedantic -Wmissing-prototypes \ -Wold-style-definition -Werror CC = clang -CFLAGS = -g -O3 -std=c99 $(WARNING) +CFLAGS = -g -std=c99 $(WARNING) LDFLAGS = -fuse-ld=lld SRC = main.c