|
|
|
@ -1,18 +1,12 @@ |
|
|
|
|
#include <curses.h> |
|
|
|
|
#include <stdlib.h> |
|
|
|
|
#include <ncurses.h> |
|
|
|
|
#include <time.h> |
|
|
|
|
#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; |
|
|
|
|
} |
|
|
|
|