curses/main.c

37 lines
840 B
C
Raw Normal View History

2022-06-29 15:27:06 +00:00
#include <stdlib.h>
#include <ncurses.h>
#include <time.h>
#include "project/extras.h"
#include "project/utils/utils.h"
2022-06-29 10:19:02 -05:00
2022-06-29 15:52:19 +00:00
int main(int argc,char**argv) {
unsigned int frameCount = 0;
2022-06-29 15:41:52 +00:00
int rows,cols;
clock_t lastTime = clock();
int FRAMETIME = CLOCKS_PER_SEC/60;
2022-06-29 15:41:52 +00:00
2022-06-29 15:27:06 +00:00
initscr();
start_color();
init_pair(1,COLOR_RED,COLOR_BLACK);
2022-06-29 15:41:52 +00:00
getmaxyx(stdscr,rows,cols);
cbreak();
2022-06-29 15:32:57 +00:00
keypad(stdscr,TRUE);
nodelay(stdscr,TRUE);
2022-06-29 15:32:57 +00:00
noecho();
2022-06-29 15:27:06 +00:00
refresh();
int ch = getch(); //410 is used when resizing the window.
getmaxyx(stdscr,rows,cols);
while (true) {
if (clock()-lastTime>FRAMETIME) {
mvprintw(5,7,"There are %dx%d squares. (%d)(%d)",rows,cols,frameCount++,getch());
refresh();
lastTime=clock();
}
}
2022-06-29 15:27:06 +00:00
getch();
endwin();
return 0;
}