From 0342289dacfaebd605d7d25ed90acd4622a6b107 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Mon, 25 Jul 2022 14:08:56 +0000 Subject: [PATCH] Row and column update on screen resize Co-authored-by: sigonasr2 --- C/scripts/build.sh | 2 +- C/scripts/md5 | 2 +- main | Bin 17624 -> 17624 bytes main.c | 28 +++++----------------------- utils/main.sh | 2 +- utils/md5 | 2 +- 6 files changed, 9 insertions(+), 27 deletions(-) diff --git a/C/scripts/build.sh b/C/scripts/build.sh index 654271e..3cbcb64 100755 --- a/C/scripts/build.sh +++ b/C/scripts/build.sh @@ -2,6 +2,6 @@ #C printf "Running program...\n\n\n" if gcc $(find . -type f -name "*.c") ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then - ./${PROJECT_NAME} + ./${PROJECT_NAME} "$@" fi printf "\n\n" diff --git a/C/scripts/md5 b/C/scripts/md5 index 203bf2d..2749234 100644 --- a/C/scripts/md5 +++ b/C/scripts/md5 @@ -1,2 +1,2 @@ -build.sh:dbb1880f6b747ec208d6f277c0be61c2 - +build.sh:fcbd8c14fe2a608d11166cf5aa7dba02 - commit.sh:89783d2e6a165aa9612c79cfbd804a35 - diff --git a/main b/main index 1734e3e472a8731ecfadebf19a463cc90b5573a1..c966ce82887d40a8bc3b8b169e9123458e0489ca 100755 GIT binary patch delta 1240 zcmZuxZERCj7{2GOExVgoYS(T9!&)^Ggm!!sJ3rYaUN}R*i4=>8#;9w8@hi$?nQjXy zOE_G+beu#9iGd$}jQEGxA0R)rcE+?>`~itJ{b6L$nq0ERbyCcjo7d;`DyznmocDP@ zp7Xr#Jtw&ZMhc8vs3#3Q4yn3&9Q-a4R0_lj3#l&BPFx*6E4+=I$=90h?#pkyezf%UVuXpFguc;kWy@L3Sgj)7j@Wn(=CUY{iW1AL#md8n@@^&0&Dxu>2*Ot?WSQ-;n4Jxw2)bdKDQv30GG=q4;u(D(kJ zN2XPlQCW^%r3sIt5qG)*6HnM-E{WNV5y)hsk>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@#Pno0#s;r|h4{D1t=9CQmN0sldS*s=Axdv=N=g(`)yMcYph{&7>~l*oZY_pD#p{yAA1+zq1Y}-3$v@Ss5B5_3$YU- zj)$|k_K11w!RZT!OrR% X{hI1vNMmI^?jQB6(d?!tzm)z3c8DEd diff --git a/main.c b/main.c index 71a3a52..da15b92 100644 --- a/main.c +++ b/main.c @@ -1,18 +1,12 @@ +#include #include #include #include #include "project/extras.h" #include "project/utils/utils.h" -struct data{ - int val1; - int val2; - int val3; -}; - int main(int argc,char**argv) { int*keyLog=calloc(25,sizeof(int)); - struct data*dataVals=calloc(3,sizeof(struct data)); unsigned short currentLogCounter=0; unsigned int frameCount = 0; int rows,cols; @@ -28,20 +22,6 @@ int main(int argc,char**argv) { nodelay(stdscr,TRUE); noecho(); - dataVals[0].val1=14; - dataVals[0].val2=16; - dataVals[0].val3=22; - dataVals[1].val1=39; - dataVals[1].val2=7; - dataVals[1].val3=64; - dataVals[2].val1=42; - dataVals[2].val2=14; - dataVals[2].val3=69; - - - mvprintw(2,7,"%d %d %d",dataVals[0].val1,dataVals[0].val2,dataVals[0].val3); - mvprintw(3,7,"%d %d %d",dataVals[1].val1,dataVals[1].val2,dataVals[1].val3); - mvprintw(4,7,"%d %d %d",dataVals[2].val1,dataVals[2].val2,dataVals[2].val3); refresh(); getmaxyx(stdscr,rows,cols); int ch=ERR; @@ -49,9 +29,12 @@ int main(int argc,char**argv) { if ((ch=getch())!=ERR) { keyLog[currentLogCounter]=ch; currentLogCounter=(currentLogCounter+1)%25; + if (ch==KEY_RESIZE) { + getmaxyx(stdscr,rows,cols); + } } if (clock()-lastTime>FRAMETIME) { - mvprintw(5,7,"There are %dx%d squares. (%d)",rows,cols,frameCount++); + mvprintw(5,7,"There are %dx%d squares. (%d)",cols,rows,frameCount++); for (int i=0;i<25;i++) { if (keyLog[i]>0) { mvprintw(6+i,2,"Key %d was pressed.",keyLog[i]); @@ -62,7 +45,6 @@ int main(int argc,char**argv) { } } free(keyLog); - free(dataVals); endwin(); return 0; } diff --git a/utils/main.sh b/utils/main.sh index d299d6b..0a4c92a 100644 --- a/utils/main.sh +++ b/utils/main.sh @@ -25,4 +25,4 @@ if [ -z "$1" ] exit fi -./$LANGUAGE/scripts/$1.sh "${*:2}" \ No newline at end of file +./$LANGUAGE/scripts/$1.sh "${@:2}" \ No newline at end of file diff --git a/utils/md5 b/utils/md5 index f7c5ca7..b8c2ada 100644 --- a/utils/md5 +++ b/utils/md5 @@ -1,4 +1,4 @@ define.sh:3ecab0dffe2adfb950f3eb7c7061b750 - -main.sh:d3d1bd0b56d8114eb7479964227f8576 - +main.sh:4e6e9f0650ec790ce2c4364db94f0caa - search.sh:81d08f5ff48e8a44b5f68387d426da05 - .updateDirectories:fa5e95db12be22ae8aed7ecbc560e38c -