diff --git a/main b/main index 3e8f1cb..3481be7 100755 Binary files a/main and b/main differ diff --git a/main.c b/main.c index e2083f7..a5a2922 100644 --- a/main.c +++ b/main.c @@ -45,11 +45,37 @@ boolean ToggleWindow(WINDOW**win,int w,int h,int x,int y) { *win=NULL; delwin(*win); clear(); + return false; } else { *win=newwin(h,w,y,x); + return true; } } +void changeColor(int*oldcol,int newcol) { + attroff(COLOR_PAIR(*oldcol)); + attron(COLOR_PAIR(newcol)); + *oldcol=newcol; +} + +//Provide the width and height that the background needs to cover as well as an offset x and y value. +void drawBackground(int*currentcol,int background_id,int x,int y,int w,int h) { + int oldcol=*currentcol; + switch(background_id) { + case 0:{ + move(y,x); + changeColor(currentcol,3); + for (int yy=0;yy=0)?currentcol-1:7); + }break; } } if (clock()-lastTime>FRAMETIME) { @@ -96,6 +142,7 @@ int main(int argc,char**argv) { messageBox=newwin(4,cols-2,rows-5,1); } //mvprintw(5,7,"There are %dx%d squares. (%d)",cols,rows,frameCount++); + drawBackground(¤tcol,0,4,4,4,4); if (messageBox!=NULL) { drawBorder(messageBox); mvwprintw(messageBox,0,0,"There are %dx%d squares. (%d) It is good!",cols,rows,frameCount); @@ -103,6 +150,9 @@ int main(int argc,char**argv) { for (int i=0;i<25;i++) { if (keyLog[i]>0) { mvprintw(6+i,2,"Key %d was pressed.",keyLog[i]); + short r,g,b; + color_content(currentcol,&r,&g,&b); + mvprintw(6+i,30,"%d %d %d",r,g,b); } } refresh();