diff --git a/main b/main index 79c6176..fc2a496 100755 Binary files a/main and b/main differ diff --git a/main.c b/main.c index 8a3f44c..1c9a269 100644 --- a/main.c +++ b/main.c @@ -2,7 +2,6 @@ #include #include #include -#include "project/extras.h" #include "project/utils/utils.h" void drawBorder(WINDOW*box) { @@ -61,6 +60,8 @@ int main(int argc,char**argv) { drawBorder(messageBox); //box(messageBox,0,0); + boolean resizeOccured=false; + refresh(); getmaxyx(stdscr,rows,cols); int ch=ERR; @@ -68,19 +69,32 @@ int main(int argc,char**argv) { if ((ch=getch())!=ERR) { keyLog[currentLogCounter]=ch; currentLogCounter=(currentLogCounter+1)%25; + if (ch=='A') { + if (messageBox!=NULL) { + messageBox=NULL; + delwin(messageBox); + clear(); + } else { + messageBox=newwin(4,cols-2,rows-5,1); + } + } if (ch==KEY_RESIZE) { + resizeOccured=true; getmaxyx(stdscr,rows,cols); - delwin(messageBox); - messageBox=newwin(4,cols-2,rows-5,1); } } if (clock()-lastTime>FRAMETIME) { + if (resizeOccured) { + resizeOccured=false; + clear(); + delwin(messageBox); + messageBox=newwin(4,cols-2,rows-5,1); + } //mvprintw(5,7,"There are %dx%d squares. (%d)",cols,rows,frameCount++); - drawBorder(messageBox); - mvwprintw(messageBox,0,0,"There are %dx%d squares. (%d) It is good!",cols,rows,frameCount++); - mvwprintw(messageBox,1,0,"There are %dx%d squares. (%d) It is good!",cols,rows,frameCount++); - mvwprintw(messageBox,2,0,"There are %dx%d squares. (%d) It is good!",cols,rows,frameCount++); - mvwprintw(messageBox,3,0,"There are %dx%d squares. (%d) It is good!",cols,rows,frameCount++); + if (messageBox!=NULL) { + drawBorder(messageBox); + mvwprintw(messageBox,0,0,"There are %dx%d squares. (%d) It is good!",cols,rows,frameCount); + } for (int i=0;i<25;i++) { if (keyLog[i]>0) { mvprintw(6+i,2,"Key %d was pressed.",keyLog[i]); @@ -89,6 +103,7 @@ int main(int argc,char**argv) { refresh(); wrefresh(messageBox); lastTime=clock(); + frameCount++; } } free(keyLog); diff --git a/project/utils/utils.c b/project/utils/utils.c deleted file mode 100644 index 2f20b91..0000000 --- a/project/utils/utils.c +++ /dev/null @@ -1,6 +0,0 @@ -#include -#include "utils.h" - -void testReach() { - addch(ACS_DEGREE); -} \ No newline at end of file diff --git a/project/utils/utils.h b/project/utils/utils.h index 4828daf..fb07948 100644 --- a/project/utils/utils.h +++ b/project/utils/utils.h @@ -1 +1,4 @@ -void testReach(); \ No newline at end of file +#define true 1 +#define false 0 +#define boolean char +#define byte char \ No newline at end of file