/* * CYBERVIS v5.0 — Terminal Spectral Engine * Build: gcc -O3 -o cybervis cybervis.c -lm -lpthread * * Usage: cybervis [help] [options] * cybervis help * cybervis -m -c -s <1-10> -d <1-10> -f --no-status */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include /* ─── ANSI ───────────────────────────────────────────────── */ #define ESC "\033" #define CSI ESC "[" #define HIDE_CURSOR CSI"?25l" #define SHOW_CURSOR CSI"?25h" #define ALT_ON ESC"[?1049h" #define ALT_OFF ESC"[?1049l" /* ─── output buffer ──────────────────────────────────────── */ #define OBUF (1<<22) static char obuf[OBUF]; static int olen=0; static inline void ob_raw(const char*s,int n){if(olen+n>=OBUF){write(1,obuf,olen);olen=0;}memcpy(obuf+olen,s,n);olen+=n;} static inline void ob_str(const char*s){ob_raw(s,strlen(s));} static inline void ob_flush(void){if(olen){write(1,obuf,olen);olen=0;}} static char _f[80]; #define OFG(r,g,b) (snprintf(_f,80,CSI"38;2;%d;%d;%dm",r,g,b),ob_str(_f)) #define OBG(r,g,b) (snprintf(_f,80,CSI"48;2;%d;%d;%dm",r,g,b),ob_str(_f)) #define OGO(r,c) (snprintf(_f,80,CSI"%d;%dH",r,c),ob_str(_f)) #define ORESET ob_str(CSI"0m") #define OBOLD ob_str(CSI"1m") #define OCLEAR ob_str(CSI"2J") #define OHOME ob_str(CSI"H") /* ─── globals ────────────────────────────────────────────── */ static volatile int running=1,mode=0,palette=0,paused=0; static volatile int spd=5,density=5,show_hud=1,bold_heads=1,inverted=0; static int W=0,H=0,fps_cap=60; static struct termios orig_termios; /* ─── 22 PALETTES ────────────────────────────────────────── */ typedef struct{int r,g,b;}RGB; typedef struct{RGB hi,mid,lo;const char*name;}Pal; static Pal pals[]={ {{180,255,180},{ 0,220, 80},{ 0, 55, 15},"PHOSPHOR" }, {{180,240,255},{ 0,180,255},{ 0, 40,110},"ICE" }, {{255,160,160},{255, 20, 60},{100, 0, 20},"BLOOD" }, {{255,255,150},{255,190, 0},{110, 70, 0},"SOLAR" }, {{220,150,255},{150, 0,255},{ 55, 0,110},"ULTRA" }, {{ 50,255,200},{ 0,200,180},{ 0, 70, 60},"NEON" }, {{220,220,220},{140,140,140},{ 50, 50, 50},"MONO" }, {{255,140, 40},{200, 80, 0},{ 80, 30, 0},"EMBER" }, {{140,255,255},{ 40,200,200},{ 0, 80, 80},"ARCTIC" }, {{255,200,255},{200, 80,200},{ 80, 0, 80},"SAKURA" }, {{200,255,100},{100,200, 0},{ 40, 80, 0},"ACID" }, {{255,255,255},{180,180,255},{ 60, 60,160},"GHOST" }, {{255,120, 80},{200, 50, 20},{ 80, 15, 0},"LAVA" }, {{100,200,255},{ 0,100,200},{ 0, 30, 80},"OCEAN" }, {{255,230,100},{200,160, 0},{ 80, 60, 0},"GOLD" }, {{180,255,120},{ 0,255, 60},{ 0,100, 20},"TOXIC" }, {{255, 80,180},{200, 0,100},{ 80, 0, 40},"PINK" }, {{120,120,255},{ 40, 40,220},{ 0, 0, 90},"COBALT" }, {{255,200,150},{180,100, 50},{ 70, 30, 0},"COPPER" }, {{150,255,200},{ 0,200,120},{ 0, 70, 40},"MINT" }, {{255,100,100},{180, 0, 0},{ 70, 0, 0},"CRIMSON" }, {{200,200,100},{130,130, 0},{ 50, 50, 0},"KHAKI" }, }; #define NPALS 22 static RGB phi(void){RGB c=pals[palette].hi; if(inverted){c.r=255-c.r;c.g=255-c.g;c.b=255-c.b;}return c;} static RGB pmi(void){RGB c=pals[palette].mid;if(inverted){c.r=255-c.r;c.g=255-c.g;c.b=255-c.b;}return c;} static RGB plo(void){RGB c=pals[palette].lo; if(inverted){c.r=255-c.r;c.g=255-c.g;c.b=255-c.b;}return c;} /* ─── timing ─────────────────────────────────────────────── */ static double now_ms(void){struct timespec ts;clock_gettime(CLOCK_MONOTONIC,&ts);return ts.tv_sec*1000.0+ts.tv_nsec/1e6;} static void get_size(void){struct winsize ws;if(ioctl(1,TIOCGWINSZ,&ws)==0){W=ws.ws_col;H=ws.ws_row;}} static void enable_raw(void){tcgetattr(0,&orig_termios);struct termios r=orig_termios;r.c_lflag&=~(ECHO|ICANON|ISIG);r.c_cc[VMIN]=0;r.c_cc[VTIME]=0;tcsetattr(0,TCSANOW,&r);} static void cleanup(void){tcsetattr(0,TCSANOW,&orig_termios);printf(SHOW_CURSOR ALT_OFF CSI"0m\n");fflush(stdout);} static void on_signal(int s){(void)s;running=0;} static void on_resize(int s){(void)s;get_size();OCLEAR;OHOME;} /* ─── cell grid ──────────────────────────────────────────── */ typedef struct{const char*ch;int r,g,b;}Cell; static Cell*grid=NULL,*pgrid=NULL; static void grid_alloc(void){free(grid);free(pgrid);grid=calloc(H*W,sizeof(Cell));pgrid=calloc(H*W,sizeof(Cell));} #define CE(r,c) grid[(r)*W+(c)] #define PE(r,c) pgrid[(r)*W+(c)] static void grid_render(void){ for(int r=0;rr==pr->r&&cu->g==pr->g&&cu->b==pr->b&&cu->ch==pr->ch)continue; OGO(r+1,c+1); if(!cu->ch||cu->ch[0]==' '||(cu->r+cu->g+cu->b==0)){ORESET;ob_str(" ");} else{OFG(cu->r,cu->g,cu->b);ob_str(cu->ch);} *pr=*cu; } } static void grid_fade(float f){ for(int i=0;i","|","*","+","-","=","~","▓","░","╬","╫","╪","▲","▼","◆","■","●"}; #define NKANA (sizeof(KANA)/sizeof(KANA[0])) static const char*rk(void){return KANA[rand()%NKANA];} static const char*BRAILLE[]={"⠁","⠂","⠃","⠄","⠅","⠆","⠇","⠈","⠉","⠊","⠋","⠌","⠍","⠎","⠏","⠐","⠑","⠒","⠓","⠔","⠕","⠖","⠗","⠘","⠙","⠚","⠛","⠜","⠝","⠞","⠟","⠠","⠡","⠢","⠣","⠤","⠥","⠦","⠧","⠨","⠩","⠪","⠫","⠬","⠭","⠮","⠯","⠰","⠱","⠲","⠳","⠴","⠵","⠶","⠷","⠸","⠹","⠺","⠻","⠼","⠽","⠾","⠿"}; #define NBRAILLE 64 static const char*BLOCKS[]={" ","▁","▂","▃","▄","▅","▆","▇","█"}; static const char*WAVEC[]={"▁","▂","▃","▄","▅","▆","▇","█","▇","▆","▅","▄","▃","▂","▁"}; static const char*DOTS[]={" ","·","∙","•","◦","○","◉","●","◈","◆","◇","░","▒","▓","█"}; /* ══════════════════════════════════════════════════════════ MODE 0 — MATRIX RAIN ══════════════════════════════════════════════════════════ */ #define MAXDROPS 1024 typedef struct{int y,col,speed,len,bright;}Drop; static Drop drops[MAXDROPS];static int ndrop=0; static void matrix_init(void){ ndrop=0;int nc=W*density/5;if(nc>MAXDROPS)nc=MAXDROPS; for(int i=0;iy/4; if(row>=0&&rowcolcol).ch=rk(); if(d->bright&&bold_heads){CE(row,d->col).r=255;CE(row,d->col).g=255;CE(row,d->col).b=255;} else{CE(row,d->col).r=h.r;CE(row,d->col).g=h.g;CE(row,d->col).b=h.b;} } d->y+=d->speed; if(d->y/4-d->len>H){d->y=-(rand()%(H*4));d->speed=1+rand()%3;d->len=6+rand()%(20+density*2);d->bright=(rand()%5==0);d->col=rand()%W;} } } /* ══════════════════════════════════════════════════════════ MODE 1 — AUDIO BARS + WAVEFORM ══════════════════════════════════════════════════════════ */ #define FFT_N 2048 #define NBANDS 128 static float ab_sm[NBANDS],ab_pk[NBANDS],ab_ph[NBANDS]; static float ao_fr[16],ao_am[16],ao_ph2[16],ao_dr[16]; static float araw[FFT_N];static double audio_t=0; static void fft_c(float*re,float*im,int n){ for(int i=1,j=0;i>1;for(;j&bit;bit>>=1)j^=bit;j^=bit;if(i10000){ao_fr[i]=10000;ao_dr[i]*=-1;}v+=sinf(ao_ph2[i])*ao_am[i];}float beat=fmodf((float)(audio_t+s*dt)*2,1);if(beat<0.03f)v+=0.6f*(1-beat/0.03f);float w=0.5f*(1-cosf(2*(float)M_PI*s/(FFT_N-1)));re[s]=v*w;im[s]=0;araw[s]=v;} audio_t+=FFT_N*dt; for(int i=0;i<16;i++){ao_am[i]+=((rand()%100-50))/80000.0f;if(ao_am[i]<0.01f)ao_am[i]=0.01f;if(ao_am[i]>0.5f)ao_am[i]=0.5f;} fft_c(re,im,FFT_N); for(int b=0;b=FFT_N/2)i1=FFT_N/2-1;float mag=0;for(int i=i0;i<=i1;i++){float m=sqrtf(re[i]*re[i]+im[i]*im[i]);if(m>mag)mag=m;}float v=mag/(FFT_N/4)*(density/5.0f);if(v>1)v=1;if(v>ab_sm[b])ab_sm[b]=v;else ab_sm[b]*=0.85f-(spd-5)*0.01f;if(ab_sm[b]>ab_pk[b]){ab_pk[b]=ab_sm[b];ab_ph[b]=(float)(25+spd*3);}else{if(ab_ph[b]>0)ab_ph[b]--;else ab_pk[b]*=0.96f;}} } static void audio_render(void){ RGB h=phi(),m=pmi(),l=plo();int vh=H-3,bw=W/NBANDS;if(bw<1)bw=1;int nb=W/bw;if(nb>NBANDS)nb=NBANDS; for(int b=0;b8)blk=8;int bx=b*bw+1; for(int r=0;r=H)continue;OGO(sr2,bx); if(r14)i=14;ob_str(WAVEC[i]);} OGO(3,1);OFG(l.r,l.g,l.b);for(int c=0;c14)i=14;ob_str(WAVEC[i]);} } /* ══════════════════════════════════════════════════════════ MODE 2 — GLITCH STORM ══════════════════════════════════════════════════════════ */ typedef struct{int row,col,w,h,r,g,b,life,ml,type,shift;}GBlk; #define MAXG 400 static GBlk gb[MAXG];static int ng=0; static const char*GC="!@#$%^&*<>{}[]|/?~`XZQW01░▒▓╬╫╪"; static void glitch_spawn(void){if(ng>=MAXG)return;RGB h=phi(),m=pmi();GBlk*b=&gb[ng++];b->row=rand()%H+1;b->col=rand()%W+1;b->w=rand()%(W/2)+2;b->h=rand()%4+1;b->life=b->ml=rand()%15+2;b->type=rand()%6;b->shift=(rand()%41)-20;int w=rand()%4;if(w==0){b->r=h.r;b->g=h.g;b->b=h.b;}else if(w==1){b->r=255;b->g=50;b->b=50;}else if(w==2){b->r=50;b->g=200;b->b=255;}else{b->r=m.r;b->g=m.g;b->b=m.b;}} static void glitch_tick(void){int rate=density*spd/3+2;for(int i=0;ilife/b->ml;OFG((int)(b->r*fd),(int)(b->g*fd),(int)(b->b*fd));int col=b->col+b->shift;if(col<1)col=1;for(int row=b->row;rowrow+b->h&&roww&&col+w<=W;w++){if(b->type==0)ob_str("█");else if(b->type==1)ob_raw(&GC[rand()%33],1);else if(b->type==2)ob_str("▬");else if(b->type==3)ob_str("▪");else if(b->type==4)ob_str("╳");else ob_str("░");}}} if(gfr%70<5){static const char*WD[]={"CORRUPT","SEGFAULT","0xDEAD","KERNEL PANIC","NULL PTR","OVERFLOW","SIGKILL","BUS ERROR","DIVIDE BY ZERO","STACK SMASH"};const char*wd=WD[(gfr/70)%10];int col=W/2-(int)strlen(wd)/2;if(col<1)col=1;OFG(h.r,h.g,h.b);OBOLD;OGO(H/2+(rand()%3-1),col);ob_str(wd);ORESET;} if(gfr%200<2){OBG(h.r,h.g,h.b);for(int r=1;rMAXN)nnds=MAXN;for(int i=0;i=0&&r0=0&&c0cl->r+cl->g+cl->b){cl->r=rr;cl->g=gg;cl->b=bb;if(dr==0)cl->ch="─";else if(dc==0)cl->ch="│";else if(sr==sc)cl->ch="╲";else cl->ch="╱";}}if(r0==r1&&c0==c1)break;int e2=2*err;if(e2>-dc){err-=dc;r0+=sr;}if(e2x+=n->vx*sf;n->y+=n->vy*sf;if(n->x<0){n->x=0;n->vx*=-1;}if(n->x>1){n->x=1;n->vx*=-1;}if(n->y<0){n->y=0;n->vy*=-1;}if(n->y>1){n->y=1;n->vy*=-1;}n->pulse+=n->pspd*sf;n->energy+=((rand()%100-50)/6000.0f);if(n->energy<0)n->energy=0;if(n->energy>1)n->energy=1;} float md=0.15f+density*0.03f; for(int i=0;i=md)continue;float s=1-dist/md,p=0.5f+0.5f*sinf(nds[i].pulse+nds[j].pulse),br=s*p*0.85f;draw_line((int)(nds[i].y*H),(int)(nds[i].x*W),(int)(nds[j].y*H),(int)(nds[j].x*W),(int)(m.r*br),(int)(m.g*br),(int)(m.b*br));} for(int i=0;iy*H),c=(int)(n->x*W);if(r<0||r>=H-1||c<0||c>=W)continue;float p=0.5f+0.5f*sinf(n->pulse);CE(r,c).ch="◈";CE(r,c).r=(int)(h.r*p);CE(r,c).g=(int)(h.g*p);CE(r,c).b=(int)(h.b*p);} } /* ══════════════════════════════════════════════════════════ MODE 4 — FIRE ══════════════════════════════════════════════════════════ */ static float*fbuf=NULL; static void fire_init(void){free(fbuf);fbuf=calloc(H*W,sizeof(float));} static void fire_tick(void){ for(int c=0;c=H-1)bl=H-2;int lc=c+(rand()%3)-1;if(lc<0)lc=0;if(lc>=W)lc=W-1;float v=fbuf[bl*W+lc]-dc*(rand()%100)/100.0f;if(v<0)v=0;fbuf[r*W+c]=v;} static const char*FC[]={" ","░","░","▒","▒","▓","▓","█","█"}; for(int r=0;r8)ci=8;CE(r,c).ch=FC[ci];if(v<0.25f){CE(r,c).r=(int)(v*4*180);CE(r,c).g=0;CE(r,c).b=0;}else if(v<0.5f){float t=(v-0.25f)*4;CE(r,c).r=180+(int)(t*75);CE(r,c).g=(int)(t*100);CE(r,c).b=0;}else if(v<0.75f){float t=(v-0.5f)*4;CE(r,c).r=255;CE(r,c).g=100+(int)(t*155);CE(r,c).b=0;}else{float t=(v-0.75f)*4;CE(r,c).r=255;CE(r,c).g=255;CE(r,c).b=(int)(t*220);}} } /* ══════════════════════════════════════════════════════════ MODE 5 — WAVE INTERFERENCE ══════════════════════════════════════════════════════════ */ static float wt=0; typedef struct{float x,y,freq,amp,phase;}WSrc; #define NWS 5 static WSrc ws[NWS]; static void wave_init(void){for(int i=0;i1)ws[i].x=1;if(ws[i].y<0)ws[i].y=0;if(ws[i].y>1)ws[i].y=1;} for(int r=0;r1)v=1;v*=density/5.0f;if(v>1)v=1;int ci=(int)(v*14);if(ci<0)ci=0;if(ci>14)ci=14;CE(r,c).ch=DOTS[ci];CE(r,c).r=(int)(l.r+v*(h.r-l.r));CE(r,c).g=(int)(l.g+v*(h.g-l.g));CE(r,c).b=(int)(l.b+v*(h.b-l.b));} } /* ══════════════════════════════════════════════════════════ MODE 6 — BRAILLE NOISE / PLASMA ══════════════════════════════════════════════════════════ */ static float pt=0; static void plasma_tick(void){ RGB h=phi(),m=pmi(),l=plo();pt+=0.03f*(spd/5.0f); for(int r=0;r1)v=1; float br=powf(fabsf(sinf(v*(float)M_PI*3+pt)),0.4f)*(density/5.0f);if(br>1)br=1; int ci=(int)(br*NBRAILLE);if(ci>=NBRAILLE)ci=NBRAILLE-1; CE(r,c).ch=BRAILLE[ci]; CE(r,c).r=(int)(l.r+br*(h.r-l.r));CE(r,c).g=(int)(l.g+br*(h.g-l.g));CE(r,c).b=(int)(l.b+br*(h.b-l.b)); } } /* ══════════════════════════════════════════════════════════ MODE 7 — STARFIELD / WARP ══════════════════════════════════════════════════════════ */ #define NSTARS 400 typedef struct{float x,y,z,pz;}Star; static Star stars[NSTARS]; static void stars_init(void){for(int i=0;ipz=s->z;s->z-=speed; if(s->z<=0){s->x=(rand()%2000-1000)/100.0f;s->y=(rand()%2000-1000)/100.0f;s->z=10;s->pz=10;continue;} int sx=(int)((s->x/s->z+1)*W/2),sy=(int)((s->y/s->z+1)*(H-1)/2); int px=(int)((s->x/s->pz+1)*W/2),py=(int)((s->y/s->pz+1)*(H-1)/2); if(sx<0||sx>=W||sy<0||sy>=H-1)continue; float bright=1.0f-s->z/10.0f; /* draw trail */ if(px>=0&&px=0&&py0.8f?"★":bright>0.5f?"✦":bright>0.3f?"·":"·"; CE(sy,sx).ch=sc;CE(sy,sx).r=(int)(h.r*bright);CE(sy,sx).g=(int)(h.g*bright);CE(sy,sx).b=(int)(h.b*bright); } } /* ══════════════════════════════════════════════════════════ MODE 8 — CELLULAR AUTOMATA (Game of Life style but visual) ══════════════════════════════════════════════════════════ */ static uint8_t*ca_grid=NULL,*ca_next=NULL; static int ca_gen=0; static void ca_init(void){ free(ca_grid);free(ca_next); ca_grid=calloc(H*W,1);ca_next=calloc(H*W,1);ca_gen=0; int alive=(int)(H*W*density*0.04f); for(int i=0;i3){CE(r,c).r=(int)(CE(r,c).r*0.85f);CE(r,c).g=(int)(CE(r,c).g*0.85f);CE(r,c).b=(int)(CE(r,c).b*0.85f);} if(ca_next[r*W+c]&&!ca_grid[r*W+c]){CE(r,c).ch="█";CE(r,c).r=h.r;CE(r,c).g=h.g;CE(r,c).b=h.b;} else if(!ca_next[r*W+c]&&ca_grid[r*W+c]){CE(r,c).ch="░";CE(r,c).r=l.r;CE(r,c).g=l.g;CE(r,c).b=l.b;} else if(ca_next[r*W+c]){CE(r,c).ch="▓";CE(r,c).r=m.r;CE(r,c).g=m.g;CE(r,c).b=m.b;} } uint8_t*tmp=ca_grid;ca_grid=ca_next;ca_next=tmp; /* re-seed occasionally */ if(ca_gen%200==0){int seeds=5+rand()%10;for(int i=0;iy/4; if(row>=0&&rowcolcol).ch=BRAILLE[rand()%NBRAILLE]; if(d->bright&&bold_heads){CE(row,d->col).r=255;CE(row,d->col).g=255;CE(row,d->col).b=255;} else{CE(row,d->col).r=h.r;CE(row,d->col).g=h.g;CE(row,d->col).b=h.b;} } d->y+=d->speed; if(d->y/4-d->len>H){d->y=-(rand()%(H*4));d->speed=1+rand()%3;d->len=6+rand()%(20+density*2);d->bright=(rand()%5==0);d->col=rand()%W;} } } /* ══════════════════════════════════════════════════════════ HUD ══════════════════════════════════════════════════════════ */ static double fps_v=60;static double fps_ts=0;static long fc=0; static const char*MNAMES[]={"MATRIX","AUDIO","GLITCH","NEURAL","FIRE","WAVE","PLASMA","WARP","CELLS","BRAILLE"}; #define NMODES 10 static void draw_hud(void){ if(!show_hud)return; RGB m=pmi();OGO(H,1);OFG(m.r/2,m.g/2,m.b/2); char buf[512]; snprintf(buf,sizeof(buf)," %-7s│%-8s│S:%d│D:%d│%.0ffps│[1-0]mode [Tab]pal [+/-]spd [[][]]den [p]pause [i]inv [b]bold [s]hud [r]rand [q/^C]quit ",MNAMES[mode],pals[palette].name,spd,density,fps_v); buf[W]='\0';ob_str(buf);ORESET; } /* ══════════════════════════════════════════════════════════ INPUT THREAD ══════════════════════════════════════════════════════════ */ static void*input_loop(void*a){ (void)a; while(running){ char c; if(read(0,&c,1)==1){ if(c=='q'||c=='Q'||c==3){running=0;break;} if(c>='1'&&c<='9')mode=c-'1'; if(c=='0')mode=9; if(c=='\t')palette=(palette+1)%NPALS; if(c=='+'||c=='='){spd++;if(spd>10)spd=10;} if(c=='-'){spd--;if(spd<1)spd=1;} if(c==']'){density++;if(density>10)density=10;} if(c=='['){density--;if(density<1)density=1;} if(c=='s'||c=='S')show_hud=!show_hud; if(c=='p'||c=='P')paused=!paused; if(c=='i'||c=='I')inverted=!inverted; if(c=='b'||c=='B')bold_heads=!bold_heads; if(c=='r'||c=='R'){palette=rand()%NPALS;spd=rand()%8+2;density=rand()%8+2;} } usleep(8000); } return NULL; } /* ══════════════════════════════════════════════════════════ HELP ══════════════════════════════════════════════════════════ */ static void show_help(void){ printf( "\n" " ██████╗██╗ ██╗██████╗ ███████╗██████╗ ██╗ ██╗██╗███████╗\n" " ██╔════╝╚██╗ ██╔╝██╔══██╗██╔════╝██╔══██╗██║ ██║██║██╔════╝\n" " ██║ ╚████╔╝ ██████╔╝█████╗ ██████╔╝██║ ██║██║███████╗\n" " ██║ ╚██╔╝ ██╔══██╗██╔══╝ ██╔══██╗╚██╗ ██╔╝██║╚════██║\n" " ╚██████╗ ██║ ██████╔╝███████╗██║ ██║ ╚████╔╝ ██║███████║\n" " ╚═════╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝╚══════╝\n" " v5.0 — Terminal Spectral Engine\n" " Build: gcc -O3 -o cybervis cybervis.c -lm -lpthread\n" "\n" " USAGE\n" " cybervis [options]\n" " cybervis help\n" "\n" " OPTIONS\n" " -m Starting mode (see MODES below)\n" " -c Starting color palette (see PALETTES below)\n" " -s <1-10> Speed (default: 5)\n" " -d <1-10> Density (default: 5)\n" " -f FPS cap 10-144 (default: 60)\n" " --no-status Hide the status bar\n" "\n" " MODES\n" " matrix [1] Katakana/kanji rain — classic\n" " audio [2] FFT spectrum analyzer + waveform\n" " glitch [3] Data corruption storm\n" " neural [4] Drifting neural network web\n" " fire [5] Fluid fire simulation\n" " wave [6] Ripple interference patterns\n" " plasma [7] Braille plasma field\n" " warp [8] Starfield warp drive\n" " cells [9] Conway's Game of Life\n" " braille [0] Braille character rain\n" "\n" " PALETTES (22 total)\n" " green/phosphor ice/cyan blood/red solar/amber\n" " ultra/purple neon mono ember\n" " arctic sakura acid ghost\n" " lava ocean gold toxic\n" " pink cobalt copper mint\n" " crimson khaki\n" "\n" " KEYBINDINGS (live, while running)\n" " 1-9, 0 Switch mode\n" " Tab Next palette\n" " + / - Speed up / down\n" " ] / [ Density up / down\n" " p Pause / unpause\n" " i Invert colors\n" " b Toggle bright heads\n" " s Toggle status bar\n" " r Randomize palette + speed + density\n" " q / Ctrl+C Quit\n" "\n" " EXAMPLES\n" " cybervis\n" " cybervis -m fire -c lava -s 8\n" " cybervis -m warp -c ghost -d 9\n" " cybervis -m plasma -c sakura -f 144\n" " cybervis -m matrix -c blood --no-status\n" "\n" ); } /* ══════════════════════════════════════════════════════════ CLI PARSING ══════════════════════════════════════════════════════════ */ static void parse_args(int argc,char**argv){ for(int i=1;i10)spd=10;} else if(!strcmp(argv[i],"-d")&&i+110)density=10;} else if(!strcmp(argv[i],"-f")&&i+1144)fps_cap=144;} else if(!strcmp(argv[i],"--no-status"))show_hud=0; } } /* ══════════════════════════════════════════════════════════ MAIN ══════════════════════════════════════════════════════════ */ int main(int argc,char**argv){ srand((unsigned)time(NULL)); parse_args(argc,argv); signal(SIGINT,on_signal);signal(SIGTERM,on_signal);signal(SIGWINCH,on_resize); get_size();if(W<10||H<5){fprintf(stderr,"Terminal too small.\n");return 1;} enable_raw();printf(ALT_ON HIDE_CURSOR);fflush(stdout);OCLEAR;OHOME;ob_flush(); grid_alloc(); matrix_init();audio_init();neural_init();fire_init();wave_init();stars_init();ca_init(); pthread_t inp;pthread_create(&inp,NULL,input_loop,NULL); int pm=-1;fps_ts=now_ms(); while(running){ double fs=now_ms(),tgt=1000.0/fps_cap; if(mode!=pm){ OCLEAR;OHOME;ob_flush(); memset(grid,0,H*W*sizeof(Cell));memset(pgrid,0,H*W*sizeof(Cell));ng=0; if(mode==0||mode==9)matrix_init(); if(mode==1)audio_init(); if(mode==3)neural_init(); if(mode==4)fire_init(); if(mode==5)wave_init(); if(mode==7)stars_init(); if(mode==8)ca_init(); pm=mode; } if(!paused){ switch(mode){ case 0:matrix_tick(); grid_render(); break; case 1:audio_tick(); audio_render(); break; case 2:glitch_tick(); glitch_render();break; case 3:neural_tick(); grid_render(); break; case 4:fire_tick(); grid_render(); break; case 5:wave_tick(); grid_render(); break; case 6:plasma_tick(); grid_render(); break; case 7:stars_tick(); grid_render(); break; case 8:ca_tick(); grid_render(); break; case 9:braille_rain_tick();grid_render(); break; } } draw_hud();ob_flush(); fc++;double n=now_ms();if(fc%30==0){fps_v=30000.0/(n-fps_ts);fps_ts=n;} double el=n-fs;if(el