Add toggle window function
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
98829e24e2
commit
ba21104974
19
main.c
19
main.c
@ -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…
x
Reference in New Issue
Block a user