Add toggle window function

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago
parent 98829e24e2
commit ba21104974
  1. BIN
      main
  2. 19
      main.c

BIN
main

Binary file not shown.

@ -39,6 +39,17 @@ void drawBorder(WINDOW*box) {
} }
} }
//Returns true if the window was toggled on, or false if it got hidden.
boolean ToggleWindow(WINDOW**win,int w,int h,int x,int y) {
if (*win!=NULL) {
*win=NULL;
delwin(*win);
clear();
} else {
*win=newwin(h,w,y,x);
}
}
int main(int argc,char**argv) { int main(int argc,char**argv) {
int*keyLog=calloc(25,sizeof(int)); int*keyLog=calloc(25,sizeof(int));
unsigned short currentLogCounter=0; unsigned short currentLogCounter=0;
@ -70,13 +81,7 @@ int main(int argc,char**argv) {
keyLog[currentLogCounter]=ch; keyLog[currentLogCounter]=ch;
currentLogCounter=(currentLogCounter+1)%25; currentLogCounter=(currentLogCounter+1)%25;
if (ch=='A') { if (ch=='A') {
if (messageBox!=NULL) { ToggleWindow(&messageBox,cols-2,4,1,rows-5);
messageBox=NULL;
delwin(messageBox);
clear();
} else {
messageBox=newwin(4,cols-2,rows-5,1);
}
} }
if (ch==KEY_RESIZE) { if (ch==KEY_RESIZE) {
resizeOccured=true; resizeOccured=true;

Loading…
Cancel
Save