You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
curses/main.c

36 lines
827 B

#include <stdlib.h>
#include <ncurses.h>
#include <time.h>
#include "project/extras.h"
#include "project/utils/utils.h"
2 years ago
2 years ago
int main(int argc,char**argv) {
unsigned int frameCount = 0;
int rows,cols;
clock_t lastTime = clock();
int FRAMETIME = CLOCKS_PER_SEC/60;
initscr();
start_color();
init_pair(1,COLOR_RED,COLOR_BLACK);
getmaxyx(stdscr,rows,cols);
cbreak();
keypad(stdscr,TRUE);
nodelay(stdscr,TRUE);
noecho();
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();
}
}
endwin();
return 0;
}